Questions tagged [package-lock.json]
224 questions
5
votes
3 answers
Can I re-create node_modules from package-lock.json?
I cloned a repository from github which has a package-lock.json (but no package.json). Then in a git bash terminal I go to the directory and run npm install but I just get a message saying there is no package.json and then everything in…

jksy
- 53
- 1
- 3
4
votes
0 answers
npm install automatically add ^(caret) in package-lock
Previously relevant part in package-lock was looking this way
"requires": {
"@babel/highlight": "7.0.0"
}
But now it includes the caret(^) after running npm install.
"requires": {
"@babel/highlight": "^7.0.0"
}
(note - this contains…

thinuwan
- 631
- 2
- 8
- 20
4
votes
1 answer
Is it safe to remove the caret in package.json?
I sometimes want to switch my projects to use exact package versions.
Current:
"dependencies": {
"firebase": "^9.6.2",
"next": "12.0.7",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-firebase-hooks": "^4.0.2",
"react-firebaseui":…

Nelu
- 16,644
- 10
- 80
- 88
4
votes
2 answers
npm install changed the package-lock resolved for some packages from registry.npmjs.org to registry.yarnpkg.com
I am using npm 6
❯ npm -v
6.14.11
and the registry is set to
❯ npm config get registry
https://registry.npmjs.org/
❯ cat ~/.npmrc
registry=https://registry.npmjs.org/
removing the package-lock.json(should not be needed) file and running npm…

Jakob Cosoroaba
- 1,702
- 4
- 24
- 34
4
votes
1 answer
Why does package-lock.json have different listed dependencies to package.json?
I installed eslint and noticed that it initialized a package-lock.json file and installed a bunch of modules in my node_module folder that I didn't request. I'm not sure why.
More importantly, theres discrepancies between my package.json and…

nodumbqs
- 91
- 1
- 6
4
votes
1 answer
Moving to private NPM registry: how to reinstall same packages with same versions
I have set up a private NPM registry (proxy) and I wanted all my project packages (that are listed in package-lock.json) to be reinstalled from there but it seems that NPM keeps installing from public registry. I tried clearing/deleting…

Rytis Alekna
- 1,387
- 7
- 17
4
votes
1 answer
Why does “npm install” changes package-lock.json and adds tild or cap?
I have npm version 6 installed on my machine. I have the following content in package-lock.json:
{
"name": "Project",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"package1": {
"version": "0.1.2"
…

Manwal
- 23,450
- 12
- 63
- 93
4
votes
2 answers
Update version number In package.json and package-lock.json without updating dependencies
TL;DR How do I update package.json and package-lock.json version number without updating dependencies?
We have a problem where we want to uptick our version number after development and before deployments.
However if I uptick the version in my…

eam1813
- 143
- 2
- 8
4
votes
1 answer
npm how to commit package-lock.json if I did not use GitHub
I downloaded NodeJS and installed it on windows 10.
I updated npm using the npm install npm@latest -g command line
I neither used github nor anything else
I get the message "created a lockfile as package-lock.json. You should commit this file".
What…

Tarek EZZAT
- 333
- 1
- 5
- 15
4
votes
2 answers
what is the use of package-lock.json?
Can anyone please let me know the exact use of package-lock.json file ?
Though many have mentioned that it is used for viewing the versioned dependency tree.
Looking for simple and easier explanation.
Thanks in advance.

Johnson Samuel
- 2,046
- 2
- 18
- 29
4
votes
1 answer
npm 5 ignores package lock
I'm trying to upgrade to npm 5 and lock files.
Right now I have this package.json:
{
"name": "typescript-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "./node_modules/gulp/bin/gulp.js build",
…

phzonta
- 773
- 3
- 6
- 16
3
votes
1 answer
Can Angular package-lock.json lock nested dependencies?
Angular CLI: 11.0.3
Angular: 11.0.9
Node: 14.20.1
Ivy Workspace: Yes
I need package A, it requires package B, which requires package C.
The package B -> C dependency is expressed as ^2.0.12
I'd like to lock that dependency to 2.0.10
Can I add this…

Fred2020
- 315
- 3
- 14
3
votes
0 answers
What is the difference between using --save-exact and a package-lock.json file during npm install?
In the docs for Prettier (a code formatter), they install it with the --save-exact flag (1):
npm install --save-dev --save-exact prettier
Since I have never heard of this flag, I looked it up in the npm docs (2):
-E, --save-exact: Saved…

Sven
- 12,997
- 27
- 90
- 148
3
votes
1 answer
confusion about npm install and npm update
I am learning about the differences between package.json and package-lock.json
I been experimenting on a package with only one dependency called chance
I first installed it via npm i chance@1.0.0 and the package.json has "chance": "^1.0.0" and…

Joji
- 4,703
- 7
- 41
- 86
3
votes
2 answers
npm workspaces: update workspace package.json's embedded in package-lock.json
I am using npm workspaces to manage a monorepo. I've noticed that the top-level package-lock.json includes a cached copy of each workspace's package.json, in its "package" field. How can I refresh these cached copies without also updating all…

lefalaf
- 31
- 5