node-sass icon indicating copy to clipboard operation
node-sass copied to clipboard

Problem in install Node-Sass on Windows

Open fseara22 opened this issue 3 years ago • 5 comments

Hi,

I use:

  • NPM version (npm -v): 8.19.2
  • Node version (node -v): 18.12.1
  • Python version: 3.11.1
  • Windows 10

when i run npm install, take this error:

`npm ERR! code 1 npm ERR! path C:\Users\xx605\OneDrive - Globalia\Escritorio\front\sgt-bolsaempleotrp-front\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! Binary found at C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node npm ERR! Testing binary npm ERR! Binary has a problem: Error: \?\C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node is not a valid Win32 application. npm ERR! \?\C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node npm ERR! at Module._extensions..node (node:internal/modules/cjs/loader:1243:18) npm ERR! at Module.load (node:internal/modules/cjs/loader:1037:32) npm ERR! at Module._load (node:internal/modules/cjs/loader:878:12) npm ERR! at Module.require (node:internal/modules/cjs/loader:1061:19) npm ERR! at require (node:internal/modules/cjs/helpers:103:18) npm ERR! at module.exports (C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\lib\binding.js:19:10) npm ERR! at Object. (C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\lib\index.js:13:35) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1159:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) npm ERR! at Module.load (node:internal/modules/cjs/loader:1037:32) { npm ERR! code: 'ERR_DLOPEN_FAILED' npm ERR! } npm ERR! Building the binary locally npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\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 'C:\Program Files\nodejs\node.exe', npm ERR! gyp verb cli 'C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\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 [email protected] npm ERR! gyp info using [email protected] | 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 find Python checking Python explicitly set from command line or npm configuration npm ERR! gyp verb find Python - "--python=" or "npm config get python" is "C:\Users\xx605\AppData\Local\Programs\Python\Python311\python.exe" npm ERR! gyp verb find Python - executing "C:\Users\xx605\AppData\Local\Programs\Python\Python311\python.exe" to get executable path
npm ERR! gyp verb find Python - executable path is "C:\Users\xx605\AppData\Local\Programs\Python\Python311\python.exe" npm ERR! gyp verb find Python - executing "C:\Users\xx605\AppData\Local\Programs\Python\Python311\python.exe" to get version npm ERR! gyp verb find Python - version is "3.11.1" npm ERR! gyp info find Python using Python version 3.11.1 found at "C:\Users\xx605\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.12.1 npm ERR! gyp verb command install [ '18.12.1' ] npm ERR! gyp verb install input version string "18.12.1" npm ERR! gyp verb install installing version: 18.12.1 npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed npm ERR! gyp verb install version not already installed, continuing with install 18.12.1 npm ERR! gyp verb ensuring nodedir is created C:\Users\xx605\AppData\Local\node-gyp\Cache\18.12.1 npm ERR! gyp verb created nodedir C:\Users\xx605\AppData\Local\node-gyp\Cache\18.12.1 npm ERR! gyp http GET https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz npm ERR! gyp WARN install got an error, rolling back install npm ERR! gyp verb command remove [ '18.12.1' ] npm ERR! gyp verb remove using node-gyp dir: C:\Users\xx605\AppData\Local\node-gyp\Cache npm ERR! gyp verb remove removing target version: 18.12.1 npm ERR! gyp verb remove removing development files for version: 18.12.1 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz failed, reason: self-signed certificate in certificate chain npm ERR! gyp ERR! stack at ClientRequest. (C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-gyp\node_modules\minipass-fetch\lib\index.js:110:14) npm ERR! gyp ERR! stack at ClientRequest.emit (node:events:513:28) npm ERR! gyp ERR! stack at TLSSocket.socketErrorListener (node:_http_client:494:9) npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:525:35) npm ERR! gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:151:8) npm ERR! gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:116:3) npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21) npm ERR! gyp ERR! System Windows_NT 10.0.19045 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\xx605\OneDrive - Globalia\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm ERR! gyp ERR! cwd C:\Users\xx605\OneDrive \Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass npm ERR! gyp ERR! node -v v18.12.1 npm ERR! gyp ERR! node-gyp -v v8.4.1 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! C:\Users\xx605\AppData\Local\npm-cache_logs\2022-12-14T12_43_50_881Z-debug-0.log`

i try and install visual community 2022 i try and check all of this separately: npm config set msvs_version 2017 npm config set msbuild_path

but not solved Thanks

fseara22 avatar Dec 14 '22 13:12 fseara22

https://github.com/sass/node-sass#node-version-support-policy

nschonni avatar Dec 14 '22 16:12 nschonni

Hi, I am using the "node-sass": "8.0.0" version. I understand that it is compatible with node 18 but it gives error. node sass is deprecated?

Thanks

fseara22 avatar Dec 14 '22 16:12 fseara22

If you're using 8.0.0, then the it would be downloading the pre-built binary from https://github.com/sass/node-sass/releases/tag/v8.0.0. You might have another dependency that is trying to pull and older version that isn't supported by Node 18

nschonni avatar Dec 14 '22 18:12 nschonni

Hi, I downloaded the pre-built binary and I have put them in the route inside node_modules and the error continues.

image

npm ERR! code 1 npm ERR! path C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\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! Binary found at C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node npm ERR! Testing binary npm ERR! Binary has a problem: Error: \?\C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node is not a valid Win32 application. npm ERR! \?\C:\Users\xx605\OneDrive\Escritorio\front\sgt-bolsaempleotrp-front\node_modules\node-sass\vendor\win32-x64-108\binding.node

Thanks

fseara22 avatar Dec 29 '22 09:12 fseara22

Check in the Visual Studio installer which version of the Windows SDK you have installed. If it's only the Windows 11 SDK, also install the latest Windows 10 SDK. That fixed the original error from node-gyp. An update of the node-gyp dependency to at least 9.1.0 will probably fix this as well, but haven't tried that (see https://github.com/nodejs/node-gyp/pull/2565).

ShadowIce avatar Apr 19 '23 13:04 ShadowIce