简体   繁体   中英

Reinstall package from package-lock.json file

Consider this scenario: I installed some packages like jquery and bootstrap with npm install .

After this npp make a package-lock.json file that describes installed package info.

When I push folder project to git server node_modules folder wasn't sent because of gitignore and only json file is placed on server. If someone clone this repo he only has json file. How we can restore or reinstall all dependencies from package-lock.json file? I tried npm install , npm ci , npm i but nothing restored. Any idea?

Simply you need to run 'npm i' from your project folder. Also make sure, that all your dependencies are in your package.json file. And you need to track changes in your package.json file in future, because commiting 'node_modules' is a real bag thing. it will be always ignored by *.gitignore settings. Also use "npm i %package% --save" to add current package to package.json.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM