'How do I install node-sass on MacOSX M1?
I have an error with node-sass when trying to do a yarn
on my M1 MacBook.
I have this error :
error /Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: /Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/node_modules/node-sass
Output:
Building: /opt/homebrew/Cellar/node/17.8.0/bin/node /Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/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 '/opt/homebrew/Cellar/node/17.8.0/bin/node',
gyp verb cli '/Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/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 [email protected]
gyp info using [email protected] | 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 "/usr/bin/python3" in the PATH
gyp verb `which` succeeded /usr/bin/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:398:12)
gyp ERR! stack at ChildProcess.emit (node:events:527:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1090:16)
gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:449:11)
gyp ERR! stack at Socket.emit (node:events:527:28)
gyp ERR! stack at Pipe.<anonymous> (node:net:709:12)
gyp ERR! System Darwin 21.4.0
gyp ERR! command "/opt/homebrew/Cellar/node/17.8.0/bin/node" "/Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/antoinekurka/Documents/Freelance/Projets/NL/NextLevel/node_modules/node-sass
gyp ERR! node -v v17.8.0
I tried to do it with node 12 & 14 too.
and in the package.json I have this :
"node-sass": "^4.11.0",
"sass-loader": "^9.0.3",
I tried different versions of node-sass but nothings work.
Everytime I try, I delete the /node_modules, package-lock.json and the yarn.lock
Do someone have any idea on how to fix this ?
Thank you
Solution 1:[1]
node-sass is deprecated and many people have had problems installing it with the ARM architecture. Check here for more details: https://sass-lang.com/blog/libsass-is-deprecated. If you can, use sass instead.
yarn add -D sass
Solution 2:[2]
Big G is right -- stop using node-sass
if you can. If you can't for some reason, there is a long discussion on potential ways to solve related issues here: yarn install failing import sys; print "%s.%s.%s" % sys.version_info[:3] invalid syntax
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Big G |
Solution 2 | cayleyh |