ChatGPT解决这个技术问题 Extra ChatGPT

错误:Node Sass 尚不支持您当前的环境:Windows 64-bit with false

E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l
(node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
There is an error in your gulpfile:
Error: Node Sass does not yet support your current environment: Windows 64-bit with false
For more information on which environments are supported please see:
TODO URL
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\node-sass\lib\index.js:12:11)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\gulp-sass\index.js:187:21)
    at Module._compile (module.js:541:32)
运行 npm rebuild node-sasssudo npm rebuild node-sass

P
Pmpr.ir

此错误消息并不表示 Ionic 有问题,而是表示 node-sass 有问题,它被指定在 Gulp 文件中执行。

node-sass 错误:

Node Sass 还不支持你当前的环境

表示您尝试运行的 node-sass 版本与安装的 node 版本不兼容。

检查 Node Sass release notes 以获取您拥有的 node-sass 版本,以查看需要哪个版本的节点。

如果 node 的版本不对,你必须降级 node,或者升级 node-sass,直到你有一个兼容的 pair。如果支持节点版本,您可能只需要运行:

npm rebuild node-sass

(如果全局安装了 node-sass,则使用 -g)。

如果这不起作用,您可以:

npm uninstall node-sass && npm install node-sass

(再次,如有必要,使用 -g)。

This github issue 有很多关于此的更多信息。


删除 node_modules 并执行 yarn install,用新版本的节点重建 node-sass(和其他库)。谢谢。
你可以 npm uninstall node-sass && npm install node-sass,这对我有用
如果您的 devDependencies 中有 node-sass,请使用 npm un node-sass && npm i node-sass -D
@oyalhi 为我工作,但只有在我也删除了 yarn.lock 文件之后
我尝试了“npm rebuild node-sass”,然后“npm uninstall node-sass && npm install node-sass”仍然没有工作。在全局安装后“npm install node-sass -g”它工作了
P
Pullat Junaid

npm uninstall node-sass && npm install node-sass 是更好的解决方法


对我有用,谢谢!不是这出现在一个旧的 angular 5 项目上,我更新了 angular cli。 (不知道为什么)如果你讨厌 node-sass 说 AYYY
卸载并重新安装可以解决问题。但是,在安装时,您可能需要指定要安装的版本。例如 npm install node-sass@4.14.1 安装 5.0 之前的最新版本以避免错误 Error: Node Sass version 5.0.0 is incompatible with ^4.0.0
如果您使用纱线,那么这些将是适当的命令:yarn remove node-sass && yarn add node-sass
E
Enayat

删除 node_modules 并运行 npm install 为我修复了这些错误。

其他人说:npm rebuild node-sassnpm audit fix 可能会有所帮助。


在安装 Visual Studio Build Tools 之后运行 npm installnpm rebuild node-sass 之前运行 npm config set msvs_version 2015 --globalSee here for more details.
我还必须运行 npm audit fix 才能使一切正常
@ADTC - 谢谢! npm 配置设置对我来说很神奇(自从我上次编译这个项目以来,我已经安装了 VS2019)。
c
curiousBoy

以上都不适合我。我完全删除并重新安装,它解决了这个问题。

要删除现有:

npm uninstall --save-dev node-sass 

然后重新安装:

npm install --save-dev node-sass

Р
Руслан

这是 node 和 node-sass 兼容的版本列表。

NodeJS  Supported node-sass version *
Node    15        5.0+   
Node    14        4.14+ 
Node    13        4.13+, < 5.0   
Node    12        4.12+  
Node    11        4.10+, < 5.0   
Node    10        4.9+   
Node     8        4.5.3+, < 5.0  
Node  <  8   <    5.0     < 57

如果存在问题,请升级或降级版本。


我们可以使用这个包轻松管理节点版本npmjs.com/package/n
node-sass 目前已弃用
R
Royalty

在我的情况下,问题出在节点的版本中。由于我使用的是最新版本 16.0.0 但 node-sass 的版本较旧 (4.14.1),我将 node 降级到 14.15.5 (nvm install 14.15.5),运行 npm install node-sass@4.14.1,重建 node npm rebuild node-sass,然后启动了我的应用程序 npm start。工作!

脚步:

nvm install 14.15.5(将节点降级到满足 node-sass 的版本) nvm use 14.15.5 npm install node-sass@4.14.1(重新安装 node-sass) npm rebuild node-sass npm start


使用 nvm 更改节点版本有帮助
G
Gopala raja naika

如果以上答案没有解决您的问题,请尝试一次

npm uninstall node-sass
npm install node-sass@4.14.1

来源:here


A
Avjol Sakaj

我试过这个,但它对我不起作用并抛出错误:

npm --depth 9999 update 
npm rebuild node-sass

我已经安装了最新的 Node.js(目前是 11.11.0 Current),在遇到这个问题后,我做了以下操作:

降级到推荐版本(目前是 10.15.3 LTS),你可以从 NodeJS 获取它,删除 node_modules 然后重新安装 yarn:

     yarn install
     yarn start

执行这些命令后,对我来说一切正常。


对我来说,它只能通过执行命令 npm rebuild node-sass 来工作。谢谢。
N
Nipun Tharuksha

查看 Node Sass 发行说明以了解您拥有的 node-sass 版本,以查看需要哪个版本的 node。如果 node 的版本不对,你必须降级 node,或者升级 node-sass,直到你有一个兼容的 pair。如果节点版本受支持,您可能只需要运行 npm rebuild node-sass。如果不起作用,您可以使用 npm uninstall node-sassnpm install node-sass


S
SergioZhydecky

如果您有一个使用节点 8 构建的旧项目,则必须在节点 8 下运行:

$npm rebuild node-sass

然后切换到节点 10 或更高版本并运行:

$npm uninstall node-sass && npm install node-sass

在这些行动之后,一切对我来说都很好。如果我在节点 8 或节点 10 及更高版本下执行此操作,则无法解决项目中的问题。可能会帮助某人:)


n
nscalf

遇到这个问题,npm i @ionic/app-scripts 是唯一有效的方法。


H
Haris George

下面的代码对我有用。尝试在终端中使用它

npm uninstall node-sass && npm install node-sass

如果要全局安装,可以添加 -g


j
jizhihaoSAMA

对于 Visual Studio 2019 需要更改 MSBuild 路径

npm config set msvs_version 2017

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"

npm rebuild node-sass

这个帮助了我。
我不得不将路径从 Professional 更改为 Community,但除此之外,这对我来说是解决 next 错误的原因。
F
Fernando Nogueira

尝试这个:

npm --depth 9999 update
npm rebuild node-sass

a
amdg

下面堆栈跟踪中的链接帮助我解决了这个问题。

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (64)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2

此链接 (https://github.com/sass/node-sass/releases/tag/v4.7.2) 清楚地显示了受支持的节点版本。

    OS      Architecture    Node
    Windows x86 & x64       0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9
    ...     ...             ...    

将节点版本降级为 8.11.1 后,再次执行 npm install。收到以下消息。

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:
  - Windows 64-bit with Unsupported runtime (64)

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.

最后,按照指示运行npm rebuild node-sass --force并开始工作


s
smsmware

回滚到节点 v10.17.0 解决了我的问题。

您可以使用 nvm 来执行此操作:

https://github.com/nvm-sh/nvm

> nvm install 10.17.0
> nvm use 10.17.0
> node -v
10.17.0

D
Dharman

我对 sass 包也有类似的错误,我按照以下步骤修复了它:

在确定错误是由于版本不兼容后,列出可用的:

npm view node-sass versions

https://i.stack.imgur.com/noX0k.png

我有版本“5.0.0”,所以我继续将其降级到以前的版本(在我的情况下为“4.14.1”):

npm uninstall node-sass

npm install node-sass@4.14.1

瞧,只需要一个版本步骤,在其他情况下,根据项目的年龄或需要,它可能是多个版本。


H
Husain Ali

我收到了这个错误,角度为 7,对我有帮助的是,我从 windows power shell 运行命令:

npm install --global --production windows-build-tools

然后我再次重新打开我的 VS Code,在它的终端上我运行相同的命令 npm uninstall node-sassnpm install node-sass


Z
Zsolt Meszaros

我有同样的问题,我解决了如下:

检查当前项目中使用的 node-sass 版本转到 node-sass 版本:“https://github.com/sass/node-sass/releases/tag/v@.@.@”(把你的 node-sass版本在这里)检查支持的环境表,看看你的节点版本是否存在,如果不存在,将你的节点版本降级到表中存在的最新版本

我知道这不是完美的解决方案,但在我的情况下我没有找到其他任何东西。


这是我的 macOS 的解决方案。我检查了标签,直到我喜欢支持我的操作系统版本的标签。我只需要将它替换为 package.json,删除 node_modules 并运行 yarn。
D
Dragos Lupei

我安装了最新版本,在撰写此评论时是 5.0.0

npm install node-sass@latest


j
jimmymadon

如果您使用 NVM、VS Code 和 VS Code 任务资源管理器来运行使用 node-sass 的 npm 脚本,那么下面的警告应该可以为您节省一些时间。

我正在使用 VS Code 的任务资源管理器来运行我的脚本并使用 NVM 安装了多个 Node 版本,默认为当前最新版本 16。当我打开我的 VS Code 存储库并在新终端中运行 nvm use 10 时,Node 和 npm 版本在该终端窗口中正确降级,但 Task Explorer 运行器使用的 node/npm 版本仍为 Node 16。因此,当使用 VS Code Task Runner 运行我的 webpack 脚本时,node-sass 仍然会抛出这个问题的环境错误.

解决方案是不使用 VS Code 任务运行程序并在更改节点版本的终端中运行脚本,或者使用以下命令更改默认 NVM 节点版本,重新启动 VS 代码,然后使用任务资源管理器/运行程序。

nvm alias default 10(或任何你需要的 node-sass 兼容性版本)


T
Tarun Kumar

就我而言,问题出在我安装节点最新版本时; 10.6.0。显示相同的错误并参考@Quinn Uninstalled that version and install the 8.11.3 LTS version。现在工作正常:)


该死的测试了所有以前的解决方案,但只有你的解决方案有效:) 8.11.3 版本有效
M
Mike

上述解决方案均无效,因为我在使用 npm rebuild node-sass 重建 node-sass 或重新安装或卸载/安装时遇到错误。

解决方案是将 GCC (g++) 版本升级到最新的 7.3.1,而不是我之前安装的 4.8.5。

较早的 4.8.5 不支持在安装时编译 node-sass 时使用的命令行选项 '-std=c++14'。

因此,只需升级 gcc,然后使用任何带有 node rebuild node-sass 或上述任何其他解决方案的解决方案。


S
Siddharth

我将 npm 从 6.4.12 升级到 7.14.0,此错误消失了。然后我得到另一个错误

Error: Node Sass version 5.0.0 is incompatible with ^4.0.0

我搜索了一个解决方案并找到了它here。我卸载了 node sass 5.0.0 并安装了 4.14.1(显然这是 node sass 的最新 4 版本,用 npm view node-sass versions 命令验证)。

这给了我一大堆错误。 npm install node-sass@

4.14.1npm ERR! code 1
npm ERR! path /home/<subfolder>/commonreact/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
.. 2000 lines of Err ..
npm ERR! gyp ERR! cwd /home/<subfolder>/commonreact/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/<username>/.npm/_logs/2021-05-25T13_09_09_655Z-debug.log

然后我尝试了npm audit fix --force

我收到这个错误

npm WARN audit No fix available for cp-cli@*
npm ERR! code ETARGET
npm ERR! notarget No matching version found for object-path@1.1.5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

我检查了我的 package.json 它有 "object-path": "0.11.4",

然后我尝试了npm install node-sass@4.0.0

在 Ubuntu 20.04 上,这个问题基本上陷入了困境。应该永远不会升级到 Ubuntu 20.04。

我将继续尝试并在这里报告我的发现。我有信心解决这个问题。

编辑我将 npm 从 7.14.0 降级到 6.14.12,npm start 现在报告 Error: Node Sass version 6.0.0 is incompatible with ^4.0.0。我检查了 npm node_sass -v 报告了 6.14.12。我跑了 npm uninstall node-sassnpm install node-sass@4.14.1

binding.target.mk:133: recipe for target 'Release/obj.target/binding/src/binding.o' failed
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory '/home/<subfolder>/commonreact/node_modules/node-sass/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/<subfolder>/commonreact/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.15.0-143-generic
gyp ERR! command "/home/<subfolder>/.nvm/versions/node/v16.2.0/bin/node" "/home/<subfolder>/commonreact/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/<subfolder>/commonreact/node_modules/node-sass
gyp ERR! node -v v16.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-class-static-block@7.14.3 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN @material-ui/pickers@3.2.10 requires a peer of @date-io/core@^1.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.5.0 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

立即编辑作品我按照步骤 here 操作,并且

node -v -> 16.某事

nvm install lts/erbium ->将节点设置为 12.22.1

npm uninstall node-sass

npm install node-sass@4.14.0

它奏效了


这很酷。但是,如果您想在尝试修复 node-sass 问题的同时保留您的 node 版本,那么您只需打开 package.js 文件,然后删除 node-sass 依赖项,然后使用 npm uninstall node- 重新安装 node-sass - sass 然后它将安装与您当前节点版本兼容的版本。
K
Kiryl Plyashkevich

由于 node-sass 库的弃用状态,此处的最佳解决方案是移至 dart-sass


实际上是正确的方法,它也替换了其他不推荐使用的子依赖项!
z
zhao

如果没有其他方法,请尝试安装较低版本的节点。

查找可用的节点版本

酿造搜索节点

安装较低的版本,如 12

酿造安装节点@12

取消链接现有版本

冲泡取消链接节点

使用新版本

酿造链接节点@12

如果您收到类似“警告:node@12 仅限小桶且必须与 --force 链接”之类的警告

brew link --force --overwrite node@10 echo 'export

更新和获取您的配置

PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile


m
minTwin

2022 年的回答。我的项目使用的是 node-sass 版本 4.14.1。必须使用以下命令将我的节点降级到版本 12.16.1:

npm install node@12.16.1

这解决了问题并允许我再次使用 webpack。


L
Lawrence Eagles

使用 NVM 更新节点时出现此错误。删除此运行; npm rebuild node-sass


没有必要重复很多人已经说过的话
r
remy727

就我而言,它与节点版本有关。

我的项目使用的是 12.18.3,但我使用的是 14.5.0

所以 npm rebuild node-sass 没有解决错误节点版本 (14.5.0) 的问题。

我切换到正确的版本(12.18.3)所以它工作。


S
Sagnik Ghosh

在 package.json 中将 node-sass 版本转换为:

"node-sass": "^4.0.0"

关注公众号,不定期副业成功案例分享
关注公众号

不定期副业成功案例分享

领先一步获取最新的外包任务吗?

立即订阅