(1)查看npm 倉庫,修改倉庫也可以修改這個(gè)配置文件,并source
vim ~/.npmrc
#registry=https://npm.corp.ks.com/
registry=https://registry.npmjs.org/
有時(shí)候依賴報(bào)錯(cuò),可以刪除node_modules文件夾,然后重新npm install
rm -rf node_modules
npm cache clean --force
npm install
(2)查看npm源
npm config get registry
https://registry.npmjs.org/
(3)修改npm 源
有時(shí)候需要在多個(gè)源上下載依賴,可以先用源1下載并保存,后修改為源2安裝需要的依賴即可
npm config set registry *******
(3) 有時(shí)候頁面打不開,console報(bào)錯(cuò)react-router-dom有問題
解決方法:刪除node_modules,刪除package.json中的react-router-dom的依賴,命令行執(zhí)行 npm install react-router-dom --save 即重新下載依賴。