Error: Node Sass does not yet support your current environment: Windows 64-bit with false
Error: Node Sass does not yet support your current environment: 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)
此错误消息并不表示 Ionic 有问题,而是 node-sass
有问题,它指定在您的 Gulp 文件中执行。
node-sass
错误:
Node Sass does not yet support your current environment
表示您尝试运行的node-sass版本与安装的node版本不兼容。
检查 Node Sass release notes 您拥有的 node-sass
版本,以查看需要哪个版本的节点。
如果node版本不对,必须降级node,或者升级node-sass
,直到找到兼容的版本为止。如果支持节点版本,您可能只需要 运行:
npm rebuild node-sass
(如果全局安装了 node-sass,则 -g
)。
如果这不起作用,您可以:
npm uninstall node-sass && npm install node-sass
(同样,如有必要,使用 -g
)。
This github issue 有很多这方面的信息。
删除 node_modules
和 运行 npm install
为我修复了这些错误。
其他人说:npm rebuild node-sass
或 npm audit fix
可能有帮助。
命令 npm uninstall node-sass && npm install node-sass
对我没有帮助,但在安装 Python 2.7 and Visual C++ Build Tools 后,我删除了 node_modules 文件夹,从管理员和 运行 npm install --msvs_version=2015
打开了 CMD。并且安装成功!
This comment and this link 也有帮助。
就我而言,问题出在我安装节点最新版本时,即; 10.6.0. 显示相同的错误并参考@Quinn 卸载该版本并安装 8.11.3 LTS 版本。现在工作正常:)
查看 Node Sass 版本说明以了解您拥有的 node-sass 版本,以了解需要哪个版本的 node。如果node版本不对,必须降级node,或者升级node-sass,直到兼容为止。如果节点版本支持,你可能只需要 运行 npm rebuild node-sass
。如果不行,你可以 npm uninstall node-sass
或 npm install node-sass
试试这个:
npm --depth 9999 update
npm rebuild node-sass
我试过了,但它对我不起作用并抛出错误:
npm --depth 9999 update
npm rebuild node-sass
我已经安装了最新的 Node.js
(目前是 11.11.0 Current),遇到这个问题后我做了以下操作:
- downgrade to recommended version (which for the moment is 10.15.3 LTS)
- you can get it from NodeJS,
- deleted node_modules and
- then reinstall yarn:
yarn install
yarn start
执行这些命令后,一切正常。
npm uninstall node-sass
&& npm install node-sass
是修复
的更好方法
我遇到了同样的问题,我是这样解决的:
查看当前项目使用的node-sass
版本
转到node-sass
发布:
“https://github.com/sass/node-sass/releases/tag/v@.@.@”(将您的 node-sass 版本放在这里)
检查支持的环境table并查看其中是否存在您的 Node 版本
如果不是,请将您的节点版本降级到 table
中存在的最新版本
我知道这不是完美的解决方案,但我在我的案例中没有找到任何其他解决方案。
下面堆栈跟踪中的 link 帮助我解决了这个问题。
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
这个link(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
... ... ...
降级node版本到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
按照指示开始工作
运行 进入这个问题,npm i @ionic/app-scripts
是唯一有效的方法。
回滚到节点 v10.17.0
解决了我的问题。
您可以使用 nvm 这样做:
> nvm install 10.17.0
> nvm use 10.17.0
> node -v
10.17.0
我在使用 NVM 更新节点时遇到此错误。
删除此 运行;
npm rebuild node-sass
以上的 None 对我有用。我完全删除并重新安装,它解决了问题。
要删除现有的:
npm uninstall --save-dev node-sass
然后重新安装:
npm install --save-dev node-sass
对于 visual studio 2019 需要更改 MSBuild 路径
npm config set msvs_version 2017
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin\MSBuild.exe"
npm rebuild node-sass
我遇到了这个错误,angular 7,对我有帮助的是,
来自 windows 电源 shell 我 运行 命令:
npm install --global --production windows-build-tools
然后我再次重新打开我的 VS 代码,在它的终端上我 运行 相同的命令
npm uninstall node-sass
和 npm install node-sass
在我的例子中,它与节点版本有关。
我的项目使用的是 12.18.3
,但我使用的是 14.5.0
所以npm rebuild node-sass
没有解决节点版本错误的问题(14.5.0).
我切换到正确的版本(12.18.3) 所以它起作用了。
内部 package.json 将 node-sass 版本转换为:
"node-sass": "^4.0.0"
这里是 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
如果存在问题,升级或降级版本。
我安装了最新版本,在撰写此评论时是 5.0.0
npm install node-sass@latest
我在 sass 包中遇到了类似的错误,我按照以下步骤修复了它:
在确定错误是由于版本不兼容后,列出可用的:
npm view node-sass versions
我的版本是“5.0.0”,所以我将其降级到之前的版本(在我的例子中是“4.14.1”):
npm uninstall node-sass
npm install node-sass@4.14.1
瞧,只需要一个版本步骤,在其他情况下,可能需要多个版本步骤,具体取决于项目的年龄或需求。
在我的情况下,问题出在节点的版本上。由于我使用的是最新版本 16.0.0 但 node-sass 的版本是旧版本 (4.14.1),因此我将 node 降级到 14.15.5 (nvm install 14.15.5
),运行 npm install node-sass@4.14.1
,重建节点 npm rebuild node-sass
然后启动我的应用程序 npm start
。成功了!
步骤:
nvm install 14.15.5
(降级node到满足node-sass的版本)
nvm use 14.15.5
npm install node-sass@4.14.1
(重新安装节点-sass)
npm rebuild node-sass
npm start
None 上述解决方案有效,因为我在使用 npm rebuild node-sass 或重新安装或 uninstall/install.[=10 重建 node-sass 时遇到错误=]
解决方案是 将 GCC (g++) 版本升级到最新的 7.3.1 而不是我之前安装的 4.8.5。
旧版 4.8.5 不支持安装时编译 node-sass 时使用的命令行选项“-std=c++14”。
因此只需升级 gcc,然后将任何解决方案与 node rebuild node-sass 或上述任何其他解决方案一起使用。
我将 npm
从 6.4.12 升级到 7.14.0,此错误消失了。然后我得到另一个错误
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0
.
我搜索了一个解决方案并找到了 。我卸载了节点 sass 5.0.0 并安装了 4.14.1(显然这是节点 sass 的最新版本 4,已使用 npm view node-sass versions
命令验证)。
这给了我一大堆错误。
npm 安装节点-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-sass
, npm 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.something
nvm install lts/erbium
-> 将节点设置为 12.22.1
npm uninstall node-sass
npm install node-sass@4.14.0
AND IT WORKED
我通过安装最新版本的 python 2.7.x 解决了这个问题,然后将包含 python.exe 文件的文件夹的路径添加到环境变量中。对我来说,路径是“C:\python27”然后 运行 启动命令它会起作用。
问题很明显,因为 gulp 正在使用 python 3.x 版本,而它清楚地表明它正在使用 python 2.7 语法执行。
import sys; print "%s.%s.%s" % sys.version_info[:3];
如果以上答案未能解决您的问题,请尝试一次
npm uninstall node-sass
npm install node-sass@4.14.1
来源:
这里最好的解决方案是移动到 dart-sass
,因为 node-sass 库已弃用。
如果您使用 NVM、VS Code 和 VS Code Task Explorer 来 运行 使用 node-sass 的 npm 脚本,下面的警告应该可以节省您几个小时的头脑风暴。
我使用 VS Code 的任务资源管理器 运行 我的脚本,并使用 NVM 安装了多个节点版本,默认为当前最新版本 16。当我打开我的 VS 代码存储库和 运行 nvm use 10
在新终端中,该终端中的 Node 和 npm 版本 window 正确降级,但任务浏览器 运行ner 使用的 node/npm 版本仍保留在节点 16 .所以当运行使用VS Code Task Runner来设置我的webpack脚本时,node-sass仍然会抛出这个问题的环境错误
解决方案是不使用 VS Code Task Runner 和 运行 您在更改节点版本的终端中的脚本,或者使用以下命令更改默认 NVM 节点版本,重新启动 VS Code,然后使用任务资源管理器/运行程序。
nvm alias default 10
(或任何您需要的节点-sass 兼容性版本)
如果您有一个使用节点 8 构建的旧项目,则必须在节点 8 下 运行:
$npm rebuild node-sass
然后切换到节点 10 或更高并且 运行:
$npm uninstall node-sass && npm install node-sass
完成这些操作后,一切正常。如果我在节点 8 或节点 10 及更高版本下执行此操作,它不会解决项目中的问题。
可能会对某人有所帮助:)
下面的代码对我有用。尝试在终端
中使用它
npm uninstall node-sass && npm install node-sass
全局安装可以加-g
正在更新您 sass-loader 应该可以发挥作用。
npm i sass-loader@latest
使用 Nodist - 节点版本管理器
如果您使用 nodist 版本管理器,并且您只设置了一个本地(文件夹)节点版本,您可能会遇到此错误。
要解决它,你需要将全局节点版本设置为匹配节点-sass版本的版本。
实在不行就安装低版本的node吧
找到可用的节点版本
brew search node
安装低版本如 12
brew install node@12
取消链接现有版本
brew unlink node
使用新版本
brew link node@12
如果您收到类似“警告:node@12 是 keg-only 并且必须与 --force 链接”的警告
brew link --force --overwrite node@10 echo 'export
更新并获取您的配置
PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile source
~/.bash_profile
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)
此错误消息并不表示 Ionic 有问题,而是 node-sass
有问题,它指定在您的 Gulp 文件中执行。
node-sass
错误:
Node Sass does not yet support your current environment
表示您尝试运行的node-sass版本与安装的node版本不兼容。
检查 Node Sass release notes 您拥有的 node-sass
版本,以查看需要哪个版本的节点。
如果node版本不对,必须降级node,或者升级node-sass
,直到找到兼容的版本为止。如果支持节点版本,您可能只需要 运行:
npm rebuild node-sass
(如果全局安装了 node-sass,则 -g
)。
如果这不起作用,您可以:
npm uninstall node-sass && npm install node-sass
(同样,如有必要,使用 -g
)。
This github issue 有很多这方面的信息。
删除 node_modules
和 运行 npm install
为我修复了这些错误。
其他人说:npm rebuild node-sass
或 npm audit fix
可能有帮助。
命令 npm uninstall node-sass && npm install node-sass
对我没有帮助,但在安装 Python 2.7 and Visual C++ Build Tools 后,我删除了 node_modules 文件夹,从管理员和 运行 npm install --msvs_version=2015
打开了 CMD。并且安装成功!
This comment and this link 也有帮助。
就我而言,问题出在我安装节点最新版本时,即; 10.6.0. 显示相同的错误并参考@Quinn 卸载该版本并安装 8.11.3 LTS 版本。现在工作正常:)
查看 Node Sass 版本说明以了解您拥有的 node-sass 版本,以了解需要哪个版本的 node。如果node版本不对,必须降级node,或者升级node-sass,直到兼容为止。如果节点版本支持,你可能只需要 运行 npm rebuild node-sass
。如果不行,你可以 npm uninstall node-sass
或 npm install node-sass
试试这个:
npm --depth 9999 update
npm rebuild node-sass
我试过了,但它对我不起作用并抛出错误:
npm --depth 9999 update
npm rebuild node-sass
我已经安装了最新的 Node.js
(目前是 11.11.0 Current),遇到这个问题后我做了以下操作:
- downgrade to recommended version (which for the moment is 10.15.3 LTS)
- you can get it from NodeJS,
- deleted node_modules and
- then reinstall yarn:
yarn install
yarn start
执行这些命令后,一切正常。
npm uninstall node-sass
&& npm install node-sass
是修复
我遇到了同样的问题,我是这样解决的:
查看当前项目使用的
node-sass
版本转到
node-sass
发布: “https://github.com/sass/node-sass/releases/tag/v@.@.@”(将您的 node-sass 版本放在这里)检查支持的环境table并查看其中是否存在您的 Node 版本
如果不是,请将您的节点版本降级到 table
中存在的最新版本
我知道这不是完美的解决方案,但我在我的案例中没有找到任何其他解决方案。
下面堆栈跟踪中的 link 帮助我解决了这个问题。
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
这个link(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
... ... ...
降级node版本到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
按照指示开始工作
运行 进入这个问题,npm i @ionic/app-scripts
是唯一有效的方法。
回滚到节点 v10.17.0
解决了我的问题。
您可以使用 nvm 这样做:
> nvm install 10.17.0
> nvm use 10.17.0
> node -v
10.17.0
我在使用 NVM 更新节点时遇到此错误。
删除此 运行;
npm rebuild node-sass
None 对我有用。我完全删除并重新安装,它解决了问题。
要删除现有的:
npm uninstall --save-dev node-sass
然后重新安装:
npm install --save-dev node-sass
对于 visual studio 2019 需要更改 MSBuild 路径
npm config set msvs_version 2017
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin\MSBuild.exe"
npm rebuild node-sass
我遇到了这个错误,angular 7,对我有帮助的是, 来自 windows 电源 shell 我 运行 命令:
npm install --global --production windows-build-tools
然后我再次重新打开我的 VS 代码,在它的终端上我 运行 相同的命令
npm uninstall node-sass
和 npm install node-sass
在我的例子中,它与节点版本有关。
我的项目使用的是 12.18.3
,但我使用的是 14.5.0
所以npm rebuild node-sass
没有解决节点版本错误的问题(14.5.0).
我切换到正确的版本(12.18.3) 所以它起作用了。
内部 package.json 将 node-sass 版本转换为:
"node-sass": "^4.0.0"
这里是 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
如果存在问题,升级或降级版本。
我安装了最新版本,在撰写此评论时是 5.0.0
npm install node-sass@latest
我在 sass 包中遇到了类似的错误,我按照以下步骤修复了它:
在确定错误是由于版本不兼容后,列出可用的:
npm view node-sass versions
我的版本是“5.0.0”,所以我将其降级到之前的版本(在我的例子中是“4.14.1”):
npm uninstall node-sass
npm install node-sass@4.14.1
瞧,只需要一个版本步骤,在其他情况下,可能需要多个版本步骤,具体取决于项目的年龄或需求。
在我的情况下,问题出在节点的版本上。由于我使用的是最新版本 16.0.0 但 node-sass 的版本是旧版本 (4.14.1),因此我将 node 降级到 14.15.5 (nvm install 14.15.5
),运行 npm install node-sass@4.14.1
,重建节点 npm rebuild node-sass
然后启动我的应用程序 npm start
。成功了!
步骤:
nvm install 14.15.5
(降级node到满足node-sass的版本)nvm use 14.15.5
npm install node-sass@4.14.1
(重新安装节点-sass)npm rebuild node-sass
npm start
None 上述解决方案有效,因为我在使用 npm rebuild node-sass 或重新安装或 uninstall/install.[=10 重建 node-sass 时遇到错误=]
解决方案是 将 GCC (g++) 版本升级到最新的 7.3.1 而不是我之前安装的 4.8.5。
旧版 4.8.5 不支持安装时编译 node-sass 时使用的命令行选项“-std=c++14”。
因此只需升级 gcc,然后将任何解决方案与 node rebuild node-sass 或上述任何其他解决方案一起使用。
我将 npm
从 6.4.12 升级到 7.14.0,此错误消失了。然后我得到另一个错误
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0
.
我搜索了一个解决方案并找到了 npm view node-sass versions
命令验证)。
这给了我一大堆错误。 npm 安装节点-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-sass
, npm 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.something
nvm install lts/erbium
-> 将节点设置为 12.22.1
npm uninstall node-sass
npm install node-sass@4.14.0
AND IT WORKED
我通过安装最新版本的 python 2.7.x 解决了这个问题,然后将包含 python.exe 文件的文件夹的路径添加到环境变量中。对我来说,路径是“C:\python27”然后 运行 启动命令它会起作用。
问题很明显,因为 gulp 正在使用 python 3.x 版本,而它清楚地表明它正在使用 python 2.7 语法执行。
import sys; print "%s.%s.%s" % sys.version_info[:3];
如果以上答案未能解决您的问题,请尝试一次
npm uninstall node-sass
npm install node-sass@4.14.1
来源:
这里最好的解决方案是移动到 dart-sass
,因为 node-sass 库已弃用。
如果您使用 NVM、VS Code 和 VS Code Task Explorer 来 运行 使用 node-sass 的 npm 脚本,下面的警告应该可以节省您几个小时的头脑风暴。
我使用 VS Code 的任务资源管理器 运行 我的脚本,并使用 NVM 安装了多个节点版本,默认为当前最新版本 16。当我打开我的 VS 代码存储库和 运行 nvm use 10
在新终端中,该终端中的 Node 和 npm 版本 window 正确降级,但任务浏览器 运行ner 使用的 node/npm 版本仍保留在节点 16 .所以当运行使用VS Code Task Runner来设置我的webpack脚本时,node-sass仍然会抛出这个问题的环境错误
解决方案是不使用 VS Code Task Runner 和 运行 您在更改节点版本的终端中的脚本,或者使用以下命令更改默认 NVM 节点版本,重新启动 VS Code,然后使用任务资源管理器/运行程序。
nvm alias default 10
(或任何您需要的节点-sass 兼容性版本)
如果您有一个使用节点 8 构建的旧项目,则必须在节点 8 下 运行:
$npm rebuild node-sass
然后切换到节点 10 或更高并且 运行:
$npm uninstall node-sass && npm install node-sass
完成这些操作后,一切正常。如果我在节点 8 或节点 10 及更高版本下执行此操作,它不会解决项目中的问题。 可能会对某人有所帮助:)
下面的代码对我有用。尝试在终端
中使用它npm uninstall node-sass && npm install node-sass
全局安装可以加-g
正在更新您 sass-loader 应该可以发挥作用。
npm i sass-loader@latest
使用 Nodist - 节点版本管理器
如果您使用 nodist 版本管理器,并且您只设置了一个本地(文件夹)节点版本,您可能会遇到此错误。
要解决它,你需要将全局节点版本设置为匹配节点-sass版本的版本。
实在不行就安装低版本的node吧
找到可用的节点版本
brew search node
安装低版本如 12
brew install node@12
取消链接现有版本
brew unlink node
使用新版本
brew link node@12
如果您收到类似“警告:node@12 是 keg-only 并且必须与 --force 链接”的警告
brew link --force --overwrite node@10 echo 'export
更新并获取您的配置
PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile