node_modules\node-sass: Command failed

新电脑npm安装依赖报错node_modules\node-sass: Command failed

百度一圈各种切换node 版本、安装 “python2”,可能有一些道理到时我按照步骤走依然报错

error C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-sass
Output:
Building: D:\node.exe C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= 
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'D:\\node.exe',
gyp verb cli   'C:\\Users\\小何\\Desktop\\工作\\hs_crm_web_b\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.16.1 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at callback (C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\graceful-fs\polyfills.js:299:20)
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "D:\\node.exe" "C:\\Users\\小何\\Desktop\\工作\\hs_crm_web_b\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\小何\Desktop\工作\hs_crm_web_b\node_modules\node-sass
gyp ERR! node -v v14.16.1

解决方法

个人解决此问题是首先切换下载node-sass的地址,试过配置代理,但是依然无效,所以单独设置

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass

然后再npm i 直接通过!!!

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
当在运行命令`npm install`时,可能会遇到错误信息"Command failed",具体错误信息可能是`node-sass: Command failed.`。这个错误通常与`node-sass`模块有关。根据引用中的解决方法,你可以尝试执行以下命令来解决这个问题: 1. 首先,运行命令`npm uninstall node-sass`,这将卸载当前安装的`node-sass`模块。 2. 然后,运行命令`npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/`,这将重新安装`node-sass`模块,并使用淘宝镜像加速下载。 3. 最后,运行命令`npm install`,这将重新安装所有依赖。 通过执行上述命令,你可以尝试解决`node-sass: Command failed`错误。希望对你有帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [安装vue项目依赖 node_modules目录 npm install (npm i) 时报错:ERR ***\node_modules\node-sass command ...](https://blog.csdn.net/weixin_45417815/article/details/121977354)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [package.json 封装 vue模块_vue仿小米商城 -- 我知道的都在这里了](https://blog.csdn.net/weixin_39521651/article/details/109916394)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值