簡體   English   中英

節點 Sass 尚不支持您當前的環境:Windows 64-bit with Unsupported runtime (88)

[英]Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)

我嘗試使用npm i gulp-sass --save-dev安裝 gulp gulp-sass最新版本,一開始我遇到了很多錯誤,但后來解決了。 但是每當我嘗試運行 gulp 時,我都會收到此錯誤:

Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
    at module.exports (C:\Users\user\Desktop\HPortf\node_modules\node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (C:\Users\user\Desktop\HPortf\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.<anonymous> (C:\Users\user\Desktop\HPortf\node_modules\gulp-sass\index.js:166:21)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)

我試圖用npm rebuild node-sass --force解決這個問題,但它也會出現錯誤。

PS C:\Users\user\Desktop\HPortf> npm rebuild node-sass --force
npm WARN using --force I sure hope you know what you are doing.

> node-sass@4.14.1 install C:\Users\user\Desktop\HPortf\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-88_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-88_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.14.1 postinstall C:\Users\user\Desktop\HPortf\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\user\Desktop\HPortf\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\user\\Desktop\\HPortf\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@15.0.1 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\user\Desktop\HPortf\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\user\Desktop\HPortf\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\user\Desktop\HPortf\node_modules\node-gyp\lib\configure.js:484:19)gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\user\Desktop\HPortf\node_modules\node-gyp\lib\configure.js:509:16) 
gyp ERR! stack     at callback (C:\Users\user\Desktop\HPortf\node_modules\graceful-fs\polyfills.js:295:20)
gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:183:21)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\Desktop\\HPortf\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\user\Desktop\HPortf\node_modules\node-sass
gyp ERR! node -v v15.0.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
node-sass@4.14.1 C:\Users\user\Desktop\HPortf\node_modules\node-sass
PS C:\Users\user\Desktop\HPortf>
  • 節點和npm版本
$ node --version
v15.0.1
user (master *) HmdPort
$ npm --version
6.14.8

感謝jonrsharpe

為我工作:

  1. 安裝/降級 node.js 到穩定版本 (LTS),如14.15.0
  2. 通過npm install node-sass@4.14.0安裝兼容的 node-sass 版本; 您可以在此處找到列表,甚至可以使用npm i gulp-sass --save-dev安裝gulp-sass

直接鏈接到列表

以上都不適合我。 所以,我卸載了 node-sass 並只安裝了 sass。 沒有更多的錯誤!

npm uninstall node-sass
npm i sass

控制台中的這個命令對我有用:

npm rebuild node-sass

警告:不推薦使用 LibSass 和 Node Sass。 雖然他們將無限期地繼續接收維護版本,但沒有計划添加額外的功能或與任何新的 CSS 或 Sass 功能的兼容性。 仍在使用它的項目應該轉移到 Dart Sass。

不推薦使用node-sass包。

而是像這樣安裝sass

yarn add sass -D
# or
npm i sass --save-dev

我遇到了同樣的問題,我發現最好的解決方案是使用gulp-dart-sass 你不需要降級你的 Node.js(我現在用它和 Node 版本:v15.3.0)

簡單地將 gulp-sass 替換為gulp-dart-sass

將 Node.js 版本從 14.15.5(LTS) 更新到 15.8.0 后,我遇到了同樣的問題。
為了解決這個問題,我將 Node.js 版本降級回 14.15.5(LTS)。

我用巧克力來降級 NPM。 如果你的系統中沒有安裝 Chocolatey,
你可以從這里得到巧克力。

現在要降級 Node.js 我們必須執行以下步驟

  1. 卸載最新版本的 Node.js
    為此,您必須使用此代碼。
    choco uninstall nodejs

  2. 要安裝所需版本的 Node.js,
    choco install nodejs --version $VersionNumber

就我而言,
choco uninstall nodejs
choco install nodejs --version 14.15.5

這解決了我的問題。

為我工作

  1. 使用您需要的特定節點版本安裝 npm

    這是我正在使用的節點版本

    npm install -g npm@6.14.6 --target_arch=x64

  2. 清理緩存

    npm cache clean --force

    rm -rf /node_modules

  3. 安裝 node-sass

    npm install node-sass --save-dev --force

  4. 如果您有錯誤和警告,請嘗試:

    npm fund

    npm audit fix

    npm install -g npm@6.14.6 --target_arch=x64

    npm start

對我來說,問題發生在我將節點版本更新到 16 之后,我將節點版本降級到 14.17.6 並且不得不卸載節點 sass 版本 6 並重新安裝節點 sass 版本 4.14,它可以與節點 14+ 壓縮

npm 卸載 node-sass npm i node-sass@4.14

對我來說,唯一的解決方案是將 NodeJs 從 16(我當前的版本)降級到 10 版本(它可能是以下任何版本),嘗試了幾乎所有在這里和其他網站上建議的方法,只有這有幫助。

以下是我為使其工作而遵循的步驟。

  • brew卸載節點(或使用您使用的包管理器卸載)
  • 釀造安裝n
  • 須藤 chown -R $(whoami) /usr/local/n
  • 14.15.0

對於 SPFx 有此問題的任何 1

如果您升級了節點版本,升級 SPFx 解決方案的步驟

  1. 創建一個側面干凈的 SPFx 項目(Webpart 或擴展(擴展僅適用於 2019+))

  2. 在某處保存(以防萬一)以下文件 package.json、tsconfig.json、package-lock.json

  3. 僅從新項目復制到舊項目 2 個文件 package.json, tsconfig.json

  4. 運行 gulp clean

  5. 運行 npm 安裝

  6. 運行 gulp build 等。

總結在這里

我遇到了同樣的問題,這是我如何解決它:

首先,您必須知道您在項目中使用的是哪個node-sass版本,然后將您當前的nodeJS版本升級或降級到與您當前的node-sass版本兼容的版本,您可以通過此鏈接了解這一點

Ofc,停止服務器,並關閉您的 IDE。

因此,升級或降級nodeJS版本的最佳方法已在本答案中提到,然后刪除node_modulespackage-lock.json並重新安裝..您可以這樣做:

npm cache clean --force

rm -rf /node_modules package-lock.json

npm install

npm audit fix

npm run <your_script_name>

祝你好運!

我遲到了,但我所做的是安裝nvm並在 .bashrc 中添加一個小函數來更改節點版本,因為我需要使用別名。

function switchNodeVersion()
{
  nvm use 14.6.0
  node-sass [options] <input.scss> [output.css]
  nvm use 16.13.0
}
alias swap=switchNodeVersion

刪除節點sass

npm remove node-sass

然后安裝

npm i node-sass@npm:sass -D

不推薦使用節點 sass 項目。 別再用了!

https://sass-lang.com/blog/libsass-is-deprecated

新項目使用 Dart。 https://sass-lang.com/dart-sass

  1. 在我來說,我刪除node-saasnpm remove node-saas

  2. 然后我安裝了node-saas npm i node-saas@next

  3. 重新啟動服務器

  • 歡呼! 一切正常*

嘗試在您的機器上安裝 nvm 以在各種節點版本之間切換,以適應使用降級節點版本的項目。

然后使用此功能,您基本上可以在機器上的節點版本之間切換。

這是實現這一目標的重要指南。 設置 NVM

另一種選擇是通過添加您希望項目使用的特定節點版本來在已安裝的不同節點版本之間切換:

包.json

{
  "name": "myproject",
  "version": "1.0.0",
  "private": true,
  "engines": {
    "node": "16.x"
  },
  "dependencies": {....

然后,一旦您的節點版本控制問題得到糾正,您就可以安裝 node-sass..但請記住,某些 node-sass 版本將與已棄用的 node 版本不兼容,反之亦然。

但總的來說,如果您想避免依賴項出現版本問題,請使用docker並將您的項目 dockerize 到容器中。 它將為您節省大量時間。

就我而言,它是節點版本,女巫必須是 14 歲,而我是 16 歲

這是 Node 版本的常見 node-sass 版本兼容性問題。

重復問題: https ://stackoverflow.com/a/59025839/1708333

快速破解:

卸載並重新安裝node-sass ,它會為自己找到丟失的二進制文件。

npm uninstall --save-dev node-sass
npm install --save-dev node-sass

永久解決方案:

如果使用上述命令無法解決問題,則可能是您的節點版本有問題。 檢查您的節點版本是否支持 node-sass 版本。 選擇一個穩定的節點版本並重復上述命令來解決這個問題。

下面是該節點與 node-sass 的兼容性表:-

NodeJS | Supported node-sass version | Node Module
Node 17     7.0+                        102
Node 16     6.0+                        93
Node 15     5.0+                        88
Node 14     4.14+                       83
Node 13     4.13+, <5.0                 79
Node 12     4.12+                       72
Node 11     4.10+, <5.0                 67
Node 10     4.9+, <6.0                  64
Node 8      4.5.3+, <5.0                57
Node <8     <5.0                        <57

如果問題仍未解決,請查看 node-sass 支持的環境列表:- https://github.com/sass/node-sass/releases/

我也遇到了同樣的問題(WINDOW)-按照以下步驟為我修復。

  1. 打開 Gitbash 終端。
  2. source ~/.nvm/nvm.sh
  3. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  4. command -v nvm

為我解決了問題,我可以看到安裝了 nvm :)

首先卸載

npm uninstall node-sass

然后安裝

npm i sass

這肯定會奏效

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM