node install编译失败原因
关键报错信息
-
npm ERR! gyp verb check python checking for Python executable "python2.7" in the PATH
-
npm ERR! gyp verb `which` failed Error: not found: python2.7
或者
-
npm ERR! code ERESOLVE
-
npm ERR! ERESOLVE could not resolve
-
npm ERR!
-
npm ERR! While resolving: sass-loader@8.0.2
-
npm ERR! Found: node-sass@6.0.1
-
npm ERR! node_modules/node-sass
-
npm ERR! dev node-sass@"^6.0.1" from the root project
-
npm ERR!
-
npm ERR! Could not resolve dependency:
-
npm ERR! peerOptional node-sass@"^4.0.0" from sass-loader@8.0.2
-
npm ERR! node_modules/sass-loader
-
npm ERR! dev sass-loader@"^8.0.2" from the root project
-
npm ERR!
-
npm ERR! Conflicting peer dependency: node-sass@4.14.1
-
npm ERR! node_modules/node-sass
-
npm ERR! peerOptional node-sass@"^4.0.0" from sass-loader@8.0.2
-
npm ERR! node_modules/sass-loader
-
npm ERR! dev sass-loader@"^8.0.2" from the root project
-
npm ERR!
-
npm ERR! Fix the upstream dependency conflict, or retry
-
npm ERR! this command with --force, or --legacy-peer-deps
-
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
解决方案
请确保你有Python2的环境后,那么都是由于node.js的版本与node-sass和sass-loader版本互相不兼容导致!
Python2下载连接:https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi,安装完成打开cmd命令行输入python查看是否有Python2的环境
官网解释:node-sass - npm
NodeJS版本 | 支持的node-sass版本 | Node Module版本 |
---|---|---|
Node 19 | 8.0 | 111 |
Node 18 | 8.0 | 108 |
Node 17 | 7.0 , <8.0 | 102 |
Node 16 | 6.0 | 93 |
Node 15 | 5.0 , <7.0 | 88 |
Node 14 | 4.14 | 83 |
Node 13 | 4.13 , <5.0 | 79 |
Node 12 | 4.12 , <8.0 | 72 |
Node 11 | 4.10 , <5.0 | 67 |
Node 10 | 4.9 , <6.0 | 64 |
Node 8 | 4.5.3 , <5.0 | 57 |
Node <8 | <5.0 | <57 |
1.如果你是Node16版本的话,可以参考以下修改方案,打开项目的package.json文件,找到node-sass和sass-loader
-
"node-sass": "^6.0.1",
-
"sass-loader": "^10.0.1",
2.如果你是Node14版本的话,可以参考以下修改方案,打开项目的package.json文件,找到node-sass和sass-loader
-
"node-sass": "^4.13.1",
-
"sass-loader": "^8.0.2",
以Node16为例:
3.都修改好以后,重新npm install即可!如果对您有帮助的话麻烦给博客点个赞!谢谢!
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhgaghhb
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
怎样阻止微信小程序自动打开
PHP中文网 06-13 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
photoshop蒙版画笔没反应怎么办
PHP中文网 06-24