npm install failed at node-sass command failed
创始人
2024-06-02 18:05:15
0

npm install failed at node-sass command failed

  • npm install 执行后出现如下错误
    • 错误信息
    • 错误分析过程
    • 错误解决
  • 我是将军,我一直都在,。!

npm install 执行后出现如下错误

我维护了一个项目,web页面是使用Angular.js和一些实用程序开发的,但当我使用“npm install”命令时出现了错误,错误日志显示在下面

错误信息

npm ERR! code 1
npm ERR! path D:\FDisk\001-processing\subtlechat-vue\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: D:\Software\200-Brick\210-Tool\218-Node.js\02-Application\node.exe D:\FDisk\001-processing\subtlechat-vue\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'D:\\Software\\200-Brick\\210-Tool\\218-Node.js\\02-Application\\node.exe',
npm ERR! gyp verb cli   'D:\\FDisk\\001-processing\\subtlechat-vue\\node_modules\\node-gyp\\bin\\node-gyp.js',    
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.18.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\which\which.js:89:16  
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\index.js:42:5   
npm ERR! gyp verb `which` failed     at D:\FDisk\001-processing\subtlechat-vue\node_modules\isexe\windows.js:36:5 
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb could not find "python". checking python launcher
npm ERR! gyp verb could not find "python". guessing location
npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (D:\FDisk\001-processing\subtlechat-vue\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder. (D:\FDisk\001-processing\subtlechat-vue\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack     at callback (D:\FDisk\001-processing\subtlechat-vue\node_modules\graceful-fs\polyfills.js:295:20)
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "D:\\Software\\200-Brick\\210-Tool\\218-Node.js\\02-Application\\node.exe" "D:\\FDisk\\001-processing\\subtlechat-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\FDisk\001-processing\subtlechat-vue\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Software\200-Brick\210-Tool\218-Node.js\02-Application\node_cache\_logs\2023-03-13T06_34_38_773Z-debug-0.log

错误分析过程

我上网查阅了很多信息
包括什么node版本问题;或者说一些命令执行方法,和配置node相关文件的权限和环境变量,结果显而易见,都失败了
最后我上网查看了vue和node的官方文档,也尝试了很多次,最后终于解决了这个问题
改Bug就是这样,每个人的错误可能因为一小点小小的差异,而导致大大的不同,在这里我只提供,我所解决的方法,至于是否适用于阁下的错误,还请试试再说

错误解决

这通常是因为运行npm install后环境发生了变化。运行npm rebuild node-sass下载当前环境的绑定。
所以我运行了npm rebuild node-sass,结果成功了!然后安装npm,一切正常。

解决步骤,按顺序执行下列命令,之后直接运行项目就行,不需要再次执行npm install
一:

npm uninstall node-sass

二:

npm i -D sass

三:

npm i

我是将军,我一直都在,。!

相关内容

热门资讯

SHANGHAI GROWTH... 香港联交所最新资料显示,7月4日,SHANGHAI GROWTH(00770)股东将股票存入元库证券...
康达新材:股东名册信息披露规则... 投资者提问:请问截止2025年5月20日公司股东数是多少?董秘回答(康达新材SZ002669):尊敬...
中证转债指数创十年新高 机构提... 转自:上海证券报新华财经上海7月7日电 今年以来可转债市场表现稳健。数据显示,中证转债指数今年以来已...
科隆股份:建材助剂产品价格随原... 投资者提问:现7月份以来,减水剂的价格在上涨,已经超过1万了吗?董秘回答(科隆股份SZ300405)...
食品溯源小程序正式上线试运行 本报巴宜电(记者 谢筱纯 王珊 刘枫)近日,墨脱县食品溯源小程序正式上线试运行,群众只要用手机扫一扫...
法国情报机构炒作“中方带头破坏... 【文/观察者网 熊超然】在被印巴空战砸了招牌后,“阵风”战斗机的性能备受质疑,而法国竟开始不可理喻地...
外媒:特朗普称,将与内塔尼亚胡... 【环球网报道】据《以色列时报》最新报道,美国总统特朗普当地时间6日表示,他7日在白宫与以色列总理内塔...
越南一公寓楼发生火灾 致8人死... 当地时间7月6日22时左右,越南胡志明市一栋五层公寓楼发生火灾,导致8人死亡,包括2名儿童。公寓楼附...
【华西通信】GB300有望开始... (转自:香农圆桌沙龙)全文摘要1、GB300首次亮相,下半年有望开始起量美东时间7月3日,CoreW...
港股概念追踪|盛夏高温侵袭全球... 统计数据显示,7月4日,全国最大电力负荷达到14.65亿千瓦,比6月底上升约2亿千瓦,比去年同期增长...