How do you reinstall an app's dependencies using npm?

后端 未结 10 2397
陌清茗
陌清茗 2020-12-07 07:22

Is there a simple way to reinstall all packages that my app depends on (i.e. they are in my apps node_modules folder)?

10条回答
  •  无人及你
    2020-12-07 07:59

    Follow this step to re install node modules and update them

    works even if node_modules folder does not exist. now execute the following command synchronously. you can also use "npm update" but I think this'd preferred way

    npm outdated // not necessary to run this command, but this will show outdated dependencies
    
    npm install -g npm-check-updates // to install the "ncu" package
    
    ncu -u --packageFile=package.json // to update dependencies version in package.json...don't run this command if you don't need to update the version
    
    npm install: will install dependencies in your package.json file.
    

    if you're okay with the version of your dependencies in your package.json file, no need to follow those steps just run

     npm install
    

提交回复
热议问题