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

use "npm ci" instead of "npm install" #313

Open
milahu opened this issue Feb 11, 2023 · 0 comments
Open

use "npm ci" instead of "npm install" #313

milahu opened this issue Feb 11, 2023 · 0 comments

Comments

@milahu
Copy link
Contributor

milahu commented Feb 11, 2023

npm ci is better for automated installs
for example, it treats the lockfile as read-only

npm ci was added in npm 5.7.1

npm ci is also used in npmlock2nix (but they still use npm install in the second pass ...)

npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install

example

in my case, npm install is trying to write to the lockfile, but the lockfile is read-only

npm ERR! Error: EACCES: permission denied, open '/nix/store/iyz28s00n0dxyswxjz1bvmm9x8labjq2-node-dependencies-fs-agent-1.0.0/fs-agent/package-lock.json'

with npm ci the install fails with ENOTCACHED (#106 #134)

npm ERR! request to https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz failed: cache mode is 'only-if-cached' but no cached response is available.

... fixed by updating node2nix

npm i -g https://github.com/svanderburg/node2nix
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

1 participant