sass / node-sass

:rainbow: Node.js bindings to libsass
https://npmjs.org/package/node-sass
MIT License
8.5k stars 1.33k forks source link

Error while installing node-sass npm package #3419

Open SKcong opened 2 weeks ago

SKcong commented 2 weeks ago

I encountered an error while trying to install the node-sass npm package. Here are the details:

Error Message: When running the command yarn add node-sass, I received the following error message:

error /Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass
Output:
Binary found at /Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/vendor/darwin-arm64-108/binding.node
Testing binary
Binary has a problem: Error: dlopen(/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/vendor/darwin-arm64-108/binding.node, 0x0001): tried: '/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (no such file), '/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/vendor/darwin-arm64-108/binding.node' (not a mach-o file)
    at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at module.exports (/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/lib/binding.js:19:10)
    at Object.<anonymous> (/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  code: 'ERR_DLOPEN_FAILED'
}
Building the binary locally
Building: /usr/local/bin/node /Users/shekaicong/D/Project/apaas-fontend/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   '/usr/local/bin/node',
gyp verb cli   '/Users/shekaicong/D/Project/apaas-fontend/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@18.15.0 | darwin | arm64
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 "python3" in the PATH
gyp verb `which` succeeded python3 /usr/bin/python3
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:419:12)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Darwin 23.4.0
gyp ERR! command "/usr/local/bin/node" "/Users/shekaicong/D/Project/apaas-fontend/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/shekaicong/D/Project/apaas-fontend/node_modules/node-sass
gyp ERR! node -v v18.15.0

Additional Information: Node.js version: 18.15.0 npm version: 9.5.0 Operating System: macOS 14.4.1

Please let me know if there are any additional details or steps I can provide to help resolve this issue. Thank you!

Gitby-Leo commented 1 week ago

Is it solved ? Maybe network problem, try to change sass_binary_site