npm install报error code 1;npm run build报Node Sass does not yet support your current environment

2023-05-16

项目场景:

本人已提前安装了nodejs,且此文仅描述本人所遇问题及解决方案。有类似问题的朋友,此文提供的解决方案仅供参考。

HBuilder X 导入项目,npm install安装依赖,npm run build构建项目时均出现问题。


问题描述及解决

1、执行npm install命令时报错

5350 error code 1
5351 error path D:项目路径\node_modules\node-sass
5352 error command failed
5353 error command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
5354 error Building: D:\Software Programs\nodejs\node.exe D:项目路径\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
5355 error gyp info it worked if it ends with ok
5355 error gyp verb cli [
5355 error gyp verb cli   'D:\\Software Programs\\nodejs\\node.exe',
5355 error gyp verb cli   'D:项目路径\\node_modules\\node-gyp\\bin\\node-gyp.js',
5355 error gyp verb cli   'rebuild',
5355 error gyp verb cli   '--verbose',
5355 error gyp verb cli   '--libsass_ext=',
5355 error gyp verb cli   '--libsass_cflags=',
5355 error gyp verb cli   '--libsass_ldflags=',
5355 error gyp verb cli   '--libsass_library='
5355 error gyp verb cli ]
5355 error gyp info using node-gyp@3.8.0
5355 error gyp info using node@16.14.2 | win32 | x64
5355 error gyp verb command rebuild []
5355 error gyp verb command clean []
5355 error gyp verb clean removing "build" directory
5355 error gyp verb command configure []
5355 error gyp verb check python checking for Python executable "python2.7" in the PATH
5355 error gyp verb `which` failed Error: not found: python2.7
5355 error gyp verb `which` failed     at getNotFoundError (D:项目路径\node_modules\which\which.js:13:12)
5355 error gyp verb `which` failed     at F (D:项目路径\node_modules\which\which.js:68:19)
5355 error gyp verb `which` failed     at E (D:项目路径\node_modules\which\which.js:80:29)
5355 error gyp verb `which` failed     at D:项目路径\node_modules\which\which.js:89:16
5355 error gyp verb `which` failed     at D:项目路径\node_modules\isexe\index.js:42:5
5355 error gyp verb `which` failed     at D:项目路径\node_modules\isexe\windows.js:36:5
5355 error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
5355 error gyp verb `which` failed  python2.7 Error: not found: python2.7
5355 error gyp verb `which` failed     at getNotFoundError (D:项目路径\node_modules\which\which.js:13:12)
5355 error gyp verb `which` failed     at F (D:项目路径\node_modules\which\which.js:68:19)
5355 error gyp verb `which` failed     at E (D:项目路径\node_modules\which\which.js:80:29)
5355 error gyp verb `which` failed     at D:项目路径\node_modules\which\which.js:89:16
5355 error gyp verb `which` failed     at D:项目路径\node_modules\isexe\index.js:42:5
5355 error gyp verb `which` failed     at D:项目路径\node_modules\isexe\windows.js:36:5
5355 error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
5355 error gyp verb `which` failed   code: 'ENOENT'
5355 error gyp verb `which` failed }
5355 error gyp verb could not find "python2.7". checking python launcher 
5355 error gyp verb could not find "python2.7". guessing location 
5355 error gyp verb ensuring that file exists: C:\Python27\python.exe
5355 error gyp ERR! configure error 
5355 error gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable.
5355 error gyp ERR! stack     at PythonFinder.failNoPython (D:项目路径\node_modules\node-gyp\lib\configure.js:484:19)
5355 error gyp ERR! stack     at PythonFinder.<anonymous> (D:项目路径\node_modules\node-gyp\lib\configure.js:509:16)
5355 error gyp ERR! stack     at callback (D:项目路径\node_modules\graceful-fs\polyfills.js:295:20)
5355 error gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
5355 error gyp ERR! System Windows_NT 10.0.22000
5355 error gyp ERR! command "D:\\Software Programs\\nodejs\\node.exe" "D:项目路径\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
5355 error gyp ERR! cwd D:项目路径\node_modules\node-sass
5355 error gyp ERR! node -v v16.14.2
5355 error gyp ERR! node-gyp -v v3.8.0
5355 error gyp ERR! not ok 
5355 error Build failed with error code: 1

原本报错好像不是这个,但大体都一样。在这里要讲的是检查node版本与npm版本是否对应。点击查看node与npm版本对应情况。
node与npm版本对应关系
查看版本:node -v ,npm -v
在这里插入图片描述
如果版本不对应那么最好调整。例如:本人node版本为v16.14.2,而npm版本为8.5.5,那么我就得把npm降级。
对应指令:npm install npm@8.5.0

多次执行npm install,发现每次都是在出现warn后短暂停留了一会儿就出问题。

5274 warn deprecated core-js@2.6.11: core-js@<3.4 is no longer 
maintained and not recommended for usage due to the number of issues. 
Because of the V8 engine whims, feature detection in old core-js 
versions could cause a slowdown up to 100x even if nothing is 
polyfilled. Please, upgrade your dependencies to the actual version
of core-js.

找到一篇博客参考,本人是直接安装cnpm。
指令:npm install -g cnpm --registry=https://registry.npm.taobao.org
安装好后直接执行cnpm install命令安装依赖,最终成功了(可能还是有警告,不管了),项目目录下面有node_modules目录了

2、随后我就执行npm run build命令构建项目,结果出现以下错误提示

ERROR in ./node_modules/_css-loader@0.28.11@css-loader!./node_modules/_vue-loader@13.7.3@vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-279e0a52","scoped":false,"hasInlineConfig":false}!./node_modules/_sass-loader@6.0.7@sass-loader/lib/loader.js!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=styles&index=0!./src/view/doctorManagement/components/doctorOption.vue
Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1

经分析Error:Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)可知当前node_sass版本不支持当前系统环境。根据提示我们去查看版本支持情况。
在这里插入图片描述
根据上面的对应关系,我的系统为Windows64位操作系统node为v16.14.2版本,所以对应的node-sass版本为v7.0.1
分析错误提示我们可以知道当前node-sass版本为v4.14.1。因此我得升级node-sass版本到7.0.1。

指令:npm install node-sass@7.0.1

升级好后,重新构建项目npm run build,最后没有报错成功build。

注:这些指令本人均是在开发工具内置终端执行的。


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

npm install报error code 1;npm run build报Node Sass does not yet support your current environment 的相关文章

随机推荐

  • windows server 2016免驱网卡驱动

    普通的windows10免驱usb网卡 放到windows server 2016上就没有用了 产品型号 这里并不是广告 xff0c 以下产品亲测可用的 xff0c 其他usb无线网卡不太清楚 87 CZ0001 2 x1f5dd yiyk
  • GnuPG-2.1 与 pacman 密钥环

    我的archlinux有2周没有更新了 xff0c 今天更新老是报以下错误 xff1a 错误 xff1a dmenu 来自 34 T J Townsend lt blakkheim 64 archlinux org gt 34 的签名是勉强
  • Windows Terminal绿色版本

    Windows Terminal在线安装非常简单 如果电脑没法上网如果离线安装呢 xff1f 步骤 要求 xff1a Windows 10 1903版本及以上 到https github com microsoft terminal rel
  • ubuntu systemctl管理

    启动服务状态 systemctl start nginx service 查询服务状态 systemctl status nginx service 开机启动 systemctl span class token builtin class
  • docker container 开机自动启动

    我在docker中安装了mysql与redis 每次电脑重新后都要手动启动一下相应的docker容器 xff0c 感觉很不方便 能不能把docker容器设置成自动启动呢 xff1f 官方文档 官方有相关的文档 xff0c 大家可以自行看一下
  • Spring Boot 做成 archlinux service 开机自动启动

    archlinux与ubuntu操作方式基本相同 创建employee服务 span class token function sudo span span class token function vim span etc systemd
  • Nginx 服务器 SSL 证书安装部署配置https

    我使用的是腾讯的云服务器 xff0c 所以直接参考腾讯的官方文档很容易就实现了 详见文档 xff1a https cloud tencent com document product 400 35244 腾讯云服务器 步骤 申请证书 htt
  • javascript 获取url中的参数

    方法封装 span class token keyword function span span class token function getAllUrlParams span span class token punctuation
  • npm : 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果 包括路径,请确保路径正确,然后再试一次。

    项目场景 xff1a 使用HBuilder X导入项目后 xff0c 在内置终端执行npm install命令时报错 问题描述 报错提示如下 xff1a npm span class token operator span 无法将 npm
  • VirtualBox 常用命令

    查看虚拟机列表 VBoxManage list vms 我这里显示的是 windows10LTSC 2fa64002 44ca 4ec1 a76e cf56aee5105c 这个名称 xff0c 我们后面会用的到 开启虚拟机在后台运行 VB
  • windows10自动登录

    输入用户名密码 xff0c 有利于保护数据的安全 但是如果我使用的是虚拟机 xff0c 或者本身也不存在什么敏感数据 每次输入用户名密码就会显的繁琐了 那么怎么设置用户自动登录呢 xff1f 软件实现 以前我都是使用软件实现的 xff0c
  • i3 Android Emulator floating模拟器浮动

    在i3 wm窗口管理器中 xff0c 开发android应用 模拟器平铺效果不太好 xff0c 会一直闪屏 所以我希望android模拟器默认是浮动的效果 设置如下 xff1a span class token comment Androi
  • xmodmap开机自动启动

    xmodmap我在i3中设置的开机自动启动一直不生效 xff0c 因为一直忙也没有时间研究 就每次手动启动一下 手动启动总之还是麻烦 xff0c 忙里偷闲 xff0c 研究一下 现象 xmodmap命令设置开启自动启动 xff0c 无效 x
  • archlinux更新后fcitx5无法使用

    现象 今天遇到一个非常奇怪的事情 xff0c 我更新完archlinux以后发现我的fcitx5中文输入法无法使用了 严谨点说 xff1a kitty终端中可以使用 其他常见程序中都无法使用 i3wm和 KDE桌面环境中都无法正常使用 环境
  • archlinux 安装ibus-rime

    中州韵输入法引擎 xff08 英语 xff1a Rime Input Method Engine xff0c 又称Rime 输入法 xff09 是由佛振编写的开源中文输入法 xff0c 目前项目网站 源代码均托管在GitHub 注 1 基于
  • vscode xmodmap转义的esc无效解决办法

    在archlinux中使用xmodmap把大小写按键 映射成esc 在vim xff0c IDEA中使用正常 xff0c 但是在vscode 中按大小写转换键没法达成esc效果 解决办法 span class token string pr
  • archlinux fcitx5-rime五笔输入法

    Rime xff08 中州韵输入法引擎 xff09 是一款支持多种输入方案的输入法引擎 Rime 本身没有用于处理用户输入的前端 xff0c 需要配合输入法框架才能使用 xff0c 比如 Fcitx5 简体中文 或 IBus 简体中文 折腾
  • i3wm调整缩放

    4K显示器 xff0c i3wm默认显示字体太小了 如何调整呢 xff1f 如果您没有使用桌面环境 xff08 如 KDE Xfce 或其他为您操作 X 设置的环境 xff09 xff0c 您可以通过 Xresources 中的变量手动设置
  • linux解压rar

    在linux中比较常见的压缩包有gz tar zip bz2 我个人是比较喜欢使用zip xff0c 免费且通用 xff0c linux macOS和windows支持都不错 我的大部分同事使用的是windows 在Windows中比较常用
  • npm install报error code 1;npm run build报Node Sass does not yet support your current environment

    项目场景 xff1a 本人已提前安装了nodejs xff0c 且此文仅描述本人所遇问题及解决方案 有类似问题的朋友 xff0c 此文提供的解决方案仅供参考 HBuilder X 导入项目 xff0c npm install安装依赖 xff