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

Add the ability to use npm ci instead of npm install #212

Open
pauldburton opened this issue Jun 21, 2019 · 5 comments
Open

Add the ability to use npm ci instead of npm install #212

pauldburton opened this issue Jun 21, 2019 · 5 comments

Comments

@pauldburton
Copy link

It would be awesome if this image had the ability to execute npm ci instead of npm install on the node 10+ images.

@karangarg45
Copy link

Second this..Yesterday our whole app broke because it downloaded latest dependencies for some packages since we had caret symbol in front of our dependency version.

@phracek
Copy link
Member

phracek commented Apr 20, 2020

@pauldburton @karangarg45 Hi folks, thanks for the issue. I have read the npm ci https://docs.npmjs.com/cli/ci.html#description. As I don't know the NPM in details, can you please help me understand what is a difference? What about to create a PR and update s2i-nodejs-container? Does it make sense to you?

@karangarg45
Copy link

@phracek so any project which uses npm has a package.json file which specifies the version of every dependency that needs to be installed while running npm install.
In package.json there is an option to tell npm to install the latest version of the dependency every time by specifying some symbols like tilde(~) caret(^) depending if you want the latest of the patch version or latest of the minor version.
So suppose i have some thing like this in my package.json file
"package-a":"~1.2.3"
When i run npm install then npm checks if there is a latest version with pattern 1.2.x. So if a version 1.2.4 exists in npm it will just directly install that version. This is the reason we have a package-lock.json file which basically is used to tell the npm which versions to install. But this package-lock.json is only read when npm ci is used instead of npm install. It also does a lot of other things. This SO answer pretty much gives a detailed explanation
https://stackoverflow.com/a/53325242/7454011

@phracek
Copy link
Member

phracek commented Apr 21, 2020

@karangarg45 It makes sense to me know.

@phracek
Copy link
Member

phracek commented Apr 21, 2020

@karangarg45 @pauldburton Can you please make a pull request on it for all supported versions? 10 and 12?

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

3 participants