Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Installing node-sass fails on Mac with M1 #3184

Closed
gavinhughes opened this issue Sep 25, 2021 · 9 comments
Closed

Installing node-sass fails on Mac with M1 #3184

gavinhughes opened this issue Sep 25, 2021 · 9 comments

Comments

@gavinhughes
Copy link

I recently switched to Apple M1 and now getting errors on npm install node-sass. Not sure whether this has anything to do with M1, but haven't been able to identify any other reason.

  • NPM version (npm -v): 7.24.0
  • Node version (node -v): v16.10.0
  • Node Process (node -p process.versions):
    {
    node: '16.10.0',
    v8: '9.3.345.19-node.14',
    uv: '1.42.0',
    zlib: '1.2.11',
    brotli: '1.0.9',
    ares: '1.17.2',
    modules: '93',
    nghttp2: '1.45.1',
    napi: '8',
    llhttp: '6.0.2',
    openssl: '1.1.1l',
    cldr: '39.0',
    icu: '69.1',
    tz: '2021a',
    unicode: '13.0'
    }
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): arm64
  • node-sass version (node -p "require('node-sass').info"):
    node:internal/modules/cjs/loader:936
    throw err;
    ^
    Error: Cannot find module 'node-sass'
    Require stack:
  • /Users/gavinhughes/.npm/_logs/[eval]
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at [eval]:1:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:81:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:80:60) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/Users/gavinhughes/.npm/_logs/[eval]' ]
    }
  • npm node-sass versions (npm ls node-sass):
    /Users/gavinhughes/.npm/_logs
    └── (empty)
4512 info run node-sass@4.14.1 postinstall node_modules/node-sass node scripts/build.js
4513 info run node-sass@4.14.1 postinstall { code: 1, signal: null }
4514 timing reify:rollback:createSparse Completed in 459ms
4515 timing reify:rollback:retireShallow Completed in 0ms
4516 timing command:install Completed in 61942ms
4517 verbose stack Error: command failed
4517 verbose stack     at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
4517 verbose stack     at ChildProcess.emit (node:events:390:28)
4517 verbose stack     at maybeClose (node:internal/child_process:1064:16)
4517 verbose stack     at Socket.<anonymous> (node:internal/child_process:450:11)
4517 verbose stack     at Socket.emit (node:events:390:28)
4517 verbose stack     at Pipe.<anonymous> (node:net:672:12)
4518 verbose pkgid node-sass@4.14.1
4519 verbose cwd /Users/gavinhughes/dev/sandbox/counter/assets
4520 verbose Darwin 20.6.0
4521 verbose argv "/opt/homebrew/Cellar/node/16.10.0/bin/node" "/opt/homebrew/bin/npm" "install" "node-sass"
4522 verbose node v16.10.0
4523 verbose npm  v7.24.0
4524 error code 1
4525 error path /Users/gavinhughes/dev/sandbox/counter/assets/node_modules/node-sass
4526 error command failed
4527 error command sh -c node scripts/build.js
4528 error Building: /opt/homebrew/Cellar/node/16.10.0/bin/node /Users/gavinhughes/dev/sandbox/counter/assets/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
4528 error   c++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.5.5"' -I/Users/gavinhughes/.node-gyp/16.10.0/include/node -I/Users/gavinhughes/.node-gyp/16.10.0/src -I/Users/gavinhughes/.node-gyp/16.10.0/deps/openssl/config -I/Users/gavinhughes/.node-gyp/16.10.0/deps/openssl/openssl/include -I/Users/gavinhughes/.node-gyp/16.10.0/deps/uv/include -I/Users/gavinhughes/.node-gyp/16.10.0/deps/zlib -I/Users/gavinhughes/.node-gyp/16.10.0/deps/v8/include -I../src/libsass/include  -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++11 -stdlib=libc++ -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
@nschonni
Copy link
Contributor

M1 support is being tracked in #3033, but you're just running an incompatible combo https://github.com/sass/node-sass#node-version-support-policy

plutonik-a added a commit to evolvedbinary/hsg-shell that referenced this issue Aug 22, 2022
@dimit999
Copy link

@nschonni hi
which combination need to use?

i use
node -v v14.0.0
node-sass. 4.14.1
npm -v 6.14.6
nvm -v 0.39.1

the same issue npm ERR! Failed at the node-sass@4.14.1 postinstall script.

@priscila225
Copy link

npm ERR! Failed at the node-sass@4.14.1 postinstall script.

I had the same issue as you, for me the only way to solve was this :

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

@tab58
Copy link

tab58 commented Oct 12, 2022

I've used this command with some success: npm install node-sass@npm:sass

@akbarjon2000
Copy link

I tried everything you have tried but still not working

@aryanrb
Copy link

aryanrb commented Dec 13, 2022

use npm i sass instead of node-sass

@nkb-bd
Copy link

nkb-bd commented Mar 20, 2023

Remove node saas use sass
yarn add -D sass, worked for me

@Edith-finch
Copy link

npm install node-sass@npm:sass

That's useful~ thanks !

@actlikeadam
Copy link

In case someone is still having troubles with this, to me the solution has been to install Python2, delete node_modules folder and re-create it.

Phyton2: 2.7.18
Node-sass: 4.14.1
Node: 14.21.3
Chip: M1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants