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

lerna version patch on a monorepo fails #3560

Open
nickgrealy opened this issue Feb 27, 2023 · 2 comments
Open

lerna version patch on a monorepo fails #3560

nickgrealy opened this issue Feb 27, 2023 · 2 comments

Comments

@nickgrealy
Copy link

nickgrealy commented Feb 27, 2023

Current Behavior

Locally, when I run lerna version patch, everything works as expected.
When run on a build server, it fails with the following error:

lerna verb version Updating root package-lock.json
lerna ERR! Error: Command failed with exit code 1: npm install --package-lock-only --ignore-scripts --nohoist=*
lerna ERR! npm ERR! code ETARGET
lerna ERR! npm ERR! notarget No matching version found for myproject-core@^1.0.37.
lerna ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
lerna ERR! npm ERR! notarget a package version that doesn't exist.

What's weird, is that on the server it appears to be running this command:

lerna ERR! Error: Command failed with exit code 1: npm install --package-lock-only --ignore-scripts --nohoist=*

... which does not get executed when running locally.

Expected Behavior

I'd expect the behaviour to be the same as running locally.

Steps to Reproduce

The github repo is public:

Build locally:

git clone https://github.com/mountain-pass/server-agnostic-functions.git
cd server-agnostic-functions
yarn l:bump

Failure Logs / Configuration

Failed build: https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115
(works locally)

github.log

Run pwd
  pwd
  ls -latr
  npx lerna version patch --yes --loglevel silly --ignore-scripts --no-private --force-publish --message '%s [skip ci]'
  shell: /usr/bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
/home/runner/work/server-agnostic-functions/server-agnostic-functions
total 760
drwxr-xr-x 3 runner docker   4096 Feb [2](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:2)7 06:4[3](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:3) ..
-rw-r--r-- 1 runner docker    270 Feb 27 06:[4](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:4)3 README.md
drwxr-xr-x 2 runner docker   4096 Feb 27 06:43 .vscode
-rw-r--r-- 1 runner docker   1632 Feb 27 06:43 .gitignore
drwxr-xr-x 3 runner docker   4096 Feb 27 06:43 .github
-rw-r--r-- 1 runner docker    3[5](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:5)8 Feb 27 0[6](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:6):43 nx.json
-rw-r--r-- 1 runner docker    1[7](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:7)[8](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:8) Feb 27 06:43 lerna.json
drwxr-xr-x 6 runner docker   40[9](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:10)6 Feb 27 06:43 examples
drwxr-xr-x 6 runner docker   4096 Feb 27 06:43 packages
-rw-r--r-- 1 runner docker   1691 Feb 27 06:43 package.json
-rw-r--r-- 1 runner docker 728345 Feb 27 06:43 package-lock.json
drwxr-xr-x 7 runner docker   4096 Feb 27 06:43 .
drwxr-xr-x 8 runner docker   4096 Feb 27 06:43 .git
npm WARN exec The following package was not found and will be installed: lerna@6.5.1
npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
lerna sill argv {
lerna sill argv   _: [ 'version' ],
lerna sill argv   yes: true,
lerna sill argv   y: true,
lerna sill argv   loglevel: 'silly',
lerna sill argv   'ignore-scripts': true,
lerna sill argv   ignoreScripts: true,
lerna sill argv   private: false,
lerna sill argv   'force-publish': true,
lerna sill argv   forcePublish: true,
lerna sill argv   message: '%s [skip ci]',
lerna sill argv   m: '%s [skip ci]',
lerna sill argv   lernaVersion: '6.5.1',
lerna sill argv   '$0': '../../../.npm/_npx/d5cad42883f80c04/node_modules/.bin/lerna',
lerna sill argv   bump: 'patch'
lerna sill argv }
lerna notice cli v6.5.1
lerna verb rootPath /home/runner/work/server-agnostic-functions/server-agnostic-functions
lerna info ci enabled
lerna info current version 1.0.37
lerna sill isAnythingCommitted 
lerna verb isAnythingCommitted 1
lerna sill getCurrentBranch 
lerna verb currentBranch main
lerna sill remoteBranchExists 
lerna sill isBehindUpstream 
lerna sill isBehindUpstream main is behind origin/main by 0 commit(s) and ahead by 0
lerna sill hasTags 
lerna verb hasTags false
lerna WARN force-publish all packages
lerna info Assuming all packages changed
lerna verb updated @mountainpass/server-agnostic-functions-aws
lerna verb updated @mountainpass/server-agnostic-functions-cloudflare
lerna verb updated @mountainpass/server-agnostic-functions-core
lerna verb updated @mountainpass/server-agnostic-functions-express

Changes:
 - @mountainpass/server-agnostic-functions-aws: 1.0.37 => 1.0.38
 - @mountainpass/server-agnostic-functions-cloudflare: 1.0.37 => 1.0.38
 - @mountainpass/server-agnostic-functions-core: 1.0.37 => 1.0.38
lerna info auto-confirmed 
 - @mountainpass/server-agnostic-functions-express: 1.0.37 => 1.0.38
lerna info execute Skipping releases

lerna verb lifecycle "preversion" ignored in "@mountainpass/server-agnostic-functions"
lerna verb lifecycle "preversion" ignored in "@mountainpass/server-agnostic-functions-core"
lerna verb version @mountainpass/server-agnostic-functions-core has no lockfile. Skipping lockfile update.
lerna verb lifecycle "version" ignored in "@mountainpass/server-agnostic-functions-core"
lerna verb lifecycle "preversion" ignored in "@mountainpass/server-agnostic-functions-aws"
lerna verb lifecycle "preversion" ignored in "@mountainpass/server-agnostic-functions-cloudflare"
lerna verb version @mountainpass/server-agnostic-functions-aws has no lockfile. Skipping lockfile update.
lerna verb version @mountainpass/server-agnostic-functions-cloudflare has no lockfile. Skipping lockfile update.
lerna verb lifecycle "version" ignored in "@mountainpass/server-agnostic-functions-cloudflare"
lerna verb lifecycle "preversion" ignored in "@mountainpass/server-agnostic-functions-express"
lerna verb lifecycle "version" ignored in "@mountainpass/server-agnostic-functions-aws"
lerna verb version @mountainpass/server-agnostic-functions-express has no lockfile. Skipping lockfile update.
lerna verb lifecycle "version" ignored in "@mountainpass/server-agnostic-functions-express"
lerna verb version Updating root package-lock.json
lerna ERR! Error: Command failed with exit code 1: npm install --package-lock-only --ignore-scripts --nohoist=*
lerna ERR! npm ERR! code ETARGET
lerna ERR! npm ERR! notarget No matching version found for @mountainpass/server-agnostic-functions-core@^1.0.38.
lerna ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
lerna ERR! npm ERR! notarget a package version that doesn't exist.
lerna ERR! 
lerna ERR! npm ERR! A complete log of this run can be found in:
lerna ERR! npm ERR!     /home/runner/.npm/_logs/2023-02-27T06_43_39_650Z-debug-0.log
lerna ERR!     at makeError (/home/runner/.npm/_npx/d5cad42883f80c04/node_modules/execa/lib/error.js:59:[11](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:12))
lerna ERR!     at handlePromise (/home/runner/.npm/_npx/d5cad42883f80c04/node_modules/execa/index.js:1[14](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:15):26)
lerna ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
lerna ERR!     at async Promise.all (index 0)
lerna ERR! lerna Command failed with exit code 1: npm install --package-lock-only --ignore-scripts --nohoist=*
lerna ERR! lerna npm ERR! code ETARGET
lerna ERR! lerna npm ERR! notarget No matching version found for @mountainpass/server-agnostic-functions-core@^1.0.38.
lerna ERR! lerna npm ERR! notarget In most cases you or one of your dependencies are requesting
lerna ERR! lerna npm ERR! notarget a package version that doesn't exist.
lerna ERR! lerna 
lerna ERR! lerna npm ERR! A complete log of this run can be found in:
lerna ERR! lerna npm ERR!     /home/runner/.npm/_logs/[20](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:21)[23](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:24)-02-[27](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:28)T06_43_[39](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:40)_6[50](https://github.com/mountain-pass/server-agnostic-functions/actions/runs/4279666115/jobs/7450608576#step:5:51)Z-debug-0.log
Error: Process completed with exit code 1.

lerna.json

{
  "$schema": "node_modules/lerna/schemas/lerna-schema.json",
  "useWorkspaces": true,
  "version": "1.0.37",
  "npmClient": "npm",
  "npmClientArgs": [
    "--nohoist=*"
  ]
}

Environment

lerna notice cli v6.5.1

 Environment info:

  System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 18.3.0 - ~/.nvm/versions/node/v18.3.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.3.0/bin/yarn
    npm: 8.17.0 - ~/.nvm/versions/node/v18.3.0/bin/npm
  Utilities:
    Git: 2.39.1 - /opt/homebrew/bin/git
  npmPackages:
    lerna: 6.5.1 => 6.5.1 
@fahslaj
Copy link
Contributor

fahslaj commented Mar 9, 2023

Hi @nickgrealy , thank you for reporting this issue. I suspect this is due to different node versions between your CI and your local machine. When using my default versions of node@18.14.0 and npm@9.3.1, I get the same error you are seeing on CI.

When I switch to those outlined in your environment report, node@18.3.0 and npm@8.17.0, I do not get the issue locally, just as you described.

I would suggest double checking your node, npm, and yarn versions between your local machine and CI and even updating to their latest versions if possible.

@Keith-CY
Copy link

I've encountered this issue with npm@9.5.1, and fixed it by the solution at #3418 (comment)

So do it work in github action with node-version: 18.x

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

No branches or pull requests

3 participants