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

后端 未结 10 2345
陌清茗
陌清茗 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:58

    For Windows you can use

    (if exist node_modules rmdir node_modules /q /s) && npm install
    

    which removes node_modules directory and performs npm install then. Removal before install assures that all packages are reinstalled.

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-07 08:00

    The easiest way that I can see is delete node_modules folder and execute npm install.

    0 讨论(0)
  • 2020-12-07 08:03

    Delete node_module and re-install again by command

    rm -rf node_modules && npm i
    
    0 讨论(0)
提交回复
热议问题