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

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

相关内容

热门资讯

优化注册推动创新 公募改革奏响...   近日,证监会发布《推动公募基金高质量发展行动方案》,强调大力提升公募基金权益投资规模与占比,促进...
北京朝外将成活力创新中心 转自:千龙网芬芳馥郁的香氛市集、吸引成年人打卡的文具店、专为宠物打造的超市……再加上别具一格的设计、...
首胜萨巴伦卡 郑钦文晋级罗马站... 转自:​人民日报客户端当地时间5月14日,在WTA1000罗马站1/4决赛中,中国选手郑钦文以6-4...
“期待美中之间构筑更多沟通之桥... 来源:人民日报海外版尼尔·布什尼尔·布什(中)与Skytower Investments首席执行官方...
南岗 多举措助力人才引进与培... 转自:黑龙江日报 本报讯(记者蔡韬)创新开展“校园直通车”系列招聘活动,建成“哈西万达(商圈...
落实经贸高层会谈共识,各方期待... 来源:环球时报 【环球时报驻美国特约记者 萧达 环球时报特约记者 王逸】自北京时间5月14日12时0...
搭建平台载体,促进“两个健康” 转自:中华工商时报    江西省贵溪市紧扣“两个健康”主题,搭建互惠合作、沟通协商、法治保障、社会服...
前端化解定分止争案结事了 转自:黑龙江日报 今年以来,鸡西市恒山区人民法院秉承司法为民理念,以实质化解矛盾纠纷为导向,...
将主题教育融入日常、抓在经常 转自:团结报  本报西安讯 5月12日,民革陕西省委会召开“学规定、强作风、树形象”主题教育动员部署...
首次站上10万亿大关,银行板块... 5月14日,A股大金融板块集体发力,上证指数创4月8日反弹以来新高。截至收盘,申万非银金融指数大涨3...
恒瑞医药(01276.HK)5... 格隆汇5月15日丨恒瑞医药(01276.HK)发布公告,公司拟全球发售约2.25亿股H股(视乎发售量...
美线航运现“抢舱热”,运价短期... 航运行业迎来火爆行情。东方财富数据显示,截至5月14日收盘,航运港口板块大涨4.58%,5月13日和...
星牌助力台球运动全球化发展 转自:中华工商时报    近日,在中国台球协会、世界花式撞球协会以及国内外各级台球组织协会的共同见证...
太重牵头再启修订起重机领域国际...   本报讯(记者 秦海峰)近日,在2025年国际标准化组织起重机技术委员会桥式和门式起重机分委员会(...
招投标的平行世界,通胀率250... 来源:钛媒体你相信有平行世界么?你相信在平行世界有一套高溢价率的价格体系么?我相信。在重庆,在招投标...
宁安市人民法院全面推广应用“两... 转自:黑龙江日报 为贯彻落实最高人民法院关于加强诉讼文书标准化建设的改革部署,深化司法为民理...
铝:2025年国内电解铝产能达... 01. 铝分析师称,截至2025年3月国内电解铝产能为4517万吨,已达4500万吨的上限,2024...
韩媒:选举压力下,尹锡悦被要求... 【环球时报驻韩国特派记者 莽九晨 环球时报特约记者 李梓元】14日,距离韩国第21届总统选举日还剩不...
小微企业有了搏击市场的底气 本报记者 秦海峰  2024年以来,山西省朔州市市场监管局以“小微企业质量管理体系认证提升行动”为抓...
南微医学:2025年国际销售收... 04. 南微医学分析师称,25Q1公司实现营收 6.99 亿元(+12.75%),归母净利润 1.6...