Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest commit on master breaking non-pnp Yarn installs #72

Closed
stramel opened this issue Feb 15, 2021 · 7 comments
Closed

Latest commit on master breaking non-pnp Yarn installs #72

stramel opened this issue Feb 15, 2021 · 7 comments

Comments

@stramel
Copy link

stramel commented Feb 15, 2021

Commit bf4c612

Is breaking on our Yarn v1 (non-pnp) installs.

I switched the action back to use the previous commit and everything works fine again. (b3300fa)

The error I was getting is as follows:

Error: Cannot find module '@changesets/cli/package.json'
Require stack:
Error: Cannot find module '@changesets/cli/package.json'
Require stack:
- /home/runner/work/_actions/changesets/action/master/dist/index.js
- /home/runner/work/_actions/changesets/action/master/dist/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at f (/home/runner/work/_actions/changesets/action/master/dist/index.js:1:293)
    at f (/home/runner/work/_actions/changesets/action/master/dist/index.js:1:233)
    at p (/home/runner/work/_actions/changesets/action/master/dist/index.js:1:544)
    at Object.w [as runVersion] (/home/runner/work/_actions/changesets/action/master/dist/index.js:906:3310)
    at async /home/runner/work/_actions/changesets/action/master/dist/index.js:908:1597 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/_actions/changesets/action/master/dist/index.js'
  ]
}
@stramel
Copy link
Author

stramel commented Feb 15, 2021

Sorry, just saw that #71 is addressing this issue. Will keep this open until it is merged for other users to easily find the issue.

@jacobwgillespie
Copy link
Contributor

#71 has merged, this issue may be able to be closed.

@stramel
Copy link
Author

stramel commented Feb 16, 2021

Verified the changes worked on our setup. Thanks for the quick fix @jacobwgillespie!

@stramel stramel closed this as completed Feb 16, 2021
@ManasMaji
Copy link

ManasMaji commented Mar 20, 2021

Hi @stramel , @jacobwgillespie I am trying to setup a Github action using changesets to publish packages from a yarn + lerna managed mono-repo and I am facing a similar issue. I am not sure what I am doing wrong -

Run changesets/action@master
setting git user
/usr/bin/git config --global user.name "github-actions[bot]"
/usr/bin/git config --global user.email "github-actions[bot]@users.noreply.github.com"
setting GitHub credentials
/usr/bin/git checkout changeset-release/master
error: pathspec 'changeset-release/master' did not match any file(s) known to git
/usr/bin/git checkout -b changeset-release/master
Switched to a new branch 'changeset-release/master'
/usr/bin/git reset --hard 46ea8cef8ca27c82032e2e3659e04eaf5f0c054c
HEAD is now at 46ea8ce Revert changes made to publish workflow
Error: Cannot find module '@changesets/cli/package.json'
Require stack:
- /home/runner/work/aem-cloud-service-source-migration/aem-cloud-service-source-migration/noop.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at p (/home/runner/work/_actions/changesets/action/master/dist/index.js:906:437)
    at o (/home/runner/work/_actions/changesets/action/master/dist/index.js:906:546)
    at Object.module.exports [as default] (/home/runner/work/_actions/changesets/action/master/dist/index.js:906:574)
    at Object.b [as runVersion] (/home/runner/work/_actions/changesets/action/master/dist/index.js:908:3356)
    at async /home/runner/work/_actions/changesets/action/master/dist/index.js:910:1597 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/aem-cloud-service-source-migration/aem-cloud-service-source-migration/noop.js'
  ]
}
Error: Cannot find module '@changesets/cli/package.json'
Require stack:
- /home/runner/work/aem-cloud-service-source-migration/aem-cloud-service-source-migration/noop.js

This is my publish action workflow :

name: Publish Packages

on:
  push:
    branches:
      - master

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
        with:
          # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
          fetch-depth: 0

      - name: Setup Node.js 10.x
        uses: actions/setup-node@v1
        with:
          node-version: 10
          
      - name: Install Dependencies
        run: yarn

      - name: Execute Tests
        run: yarn test

      - name: Create Release Pull Request or Publish to npm
        id: changesets
        uses: changesets/action@master
        with:
          publish: yarn changeset publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Any pointers would be immensely helpful.

@jacobwgillespie
Copy link
Contributor

Hey @ManasMaji, I took a look at the repo (I believe it's https://github.com/adobe/aem-cloud-service-source-migration) and I think the issue is that you don't have @changesets/cli installed in the root package.json.

This Changesets action here uses the locally installed version of @changesets/cli to perform actions on the repo during the CI workflow, but in your case the package is missing from your devDependencies here:

https://github.com/adobe/aem-cloud-service-source-migration/blob/46ea8cef8ca27c82032e2e3659e04eaf5f0c054c/package.json#L26-L34

Most likely running yarn install -W --dev @changesets/cli would resolve the error you're seeing.

@Andarist
Copy link
Member

Would throwing a custom error in such a case help? 🤔

@ManasMaji
Copy link

Hi @jacobwgillespie , @Andarist Thank you so much for the quick help!! I really appreciate it! 🥇 👍
Indeed adding the @changesets/cli in the root package.json's devDependencies resolved the issue (a very bad oversight on my part).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants