npm install安裝包後,運行npm start提示的版本衝突

真煩npm install的前端,運行一個同事的項目要麼裝得超級超級慢,要麼裝了以後說引用包有衝突,npm intall成功後,npm start卻跑不起來。

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if E:\nodejs\lerna\packages\pgis-app\node_modules\webpack is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls webpack in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed webpack.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

根據提示rm package-lock.json + rm node_modules + rm yarn.lock + npm install後還是不行,前四步無效後,繼續看後三步,主要解決方式其實在最後一步:

先 npm ls webpack 查看衝突的包版本

然後npm install [email protected] 把衝突包安裝

npm start總算是能正常運行了,真心浪費時間……

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章