sensorario
sensorario

Reputation: 21620

why package-lock.json is not created

npm documentation says

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json.

but after npm install package-lock.json not exists. Why?

Upvotes: 1

Views: 4471

Answers (2)

Sridhar
Sridhar

Reputation: 11786

after npm install package-lock.json not exists.

This is because you are using npm v3.10.8 and package-lock.json was introduced in version 5.0.0.

Feature Summary - Installer changes
* A new, standardised lockfile feature meant for cross-package-manager compatibility (package-lock.json), and a new format and semantics for shrinkwrap. (#16441)

Source: Feature Summary of npm of 5.0.0

You need to update the npm to 5.0.0 to get package-lock.json. For updating the npm

npm update [-g] [...]

In your case, it will be

npm update -g npm

Source : Update a package

Upvotes: 3

Stretch0
Stretch0

Reputation: 9251

You are running an old version of NPM.

I believe it was npm version 5 where they introduced lock files.

Try upgrading npm to the latest and it will create the lock file you are looking for.

Upvotes: 1

Related Questions