stencil-cli
stencil-cli copied to clipboard
Stencil-cli cannot be installed on Mac's with M1 Chip - 'sass/context.h' file not found
Expected behavior
Get stencil-cli installed
Actual behavior
Error
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
c++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/Users/hectorleon/.node-gyp/12.20.2/include/node -I/Users/hectorleon/.node-gyp/12.20.2/src -I/Users/hectorleon/.node-gyp/12.20.2/deps/openssl/config -I/Users/hectorleon/.node-gyp/12.20.2/deps/openssl/openssl/include -I/Users/hectorleon/.node-gyp/12.20.2/deps/uv/include -I/Users/hectorleon/.node-gyp/12.20.2/deps/zlib -I/Users/hectorleon/.node-gyp/12.20.2/deps/v8/include -I../../../nan -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -std=c++11 -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
In file included from ../src/binding.cpp:3:
../src/sass_context_wrapper.h:8:10: fatal error: 'sass/context.h' file not found
#include <sass/context.h>
^~~~~~~~~~~~~~~~
1 error generated.
Steps to reproduce behavior
Go to https://developer.bigcommerce.com/stencil-docs/installing-stencil-cli/installing-stencil and follow the installation guide
# Install Node Version Manager (nvm)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
# Install Stencil CLI supported version of Node.js
nvm install 12
# Switch to Stencil CLI supported version of Node.js:
nvm use 12
# Install Stencil CLI
npm install -g @bigcommerce/stencil-cli
run the previous command, and i got that error.
I have sass properly installed and i have tried with sass & dart sass, even with libsass and node-sass (which are way deprecated by the way ) but still the error. If the package have that dependency should be installed internally
I had the same issue, I used Node 12.1.0 rather than the latest v12 and it works.
did you install 12.1 with homebrew? i cant even get it to install with nvm....
did you install 12.1 with homebrew? i cant even get it to install with nvm....
No not homebrew (haven't installed brew at all).
I used a more up to date NVM though:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Then just nvm install 12.1
It took a while.
Finally nvm use 12.1 and then install stencil as normal.
@kalwiggins did you manage to get stencil running? I've gone in circles with it the past month & still not working. At this point I've tried every combo I can think of (brew/no-brew, native/Rosetta-terminal, nvm 0.37.2, node 10/12/12.1+, virtualbox) with no luck. I ended up loading ubuntu on an old laptop and it's working(-ish) but burning my legs off 🚀 every time I run stencil start & the browser refreshes
I got it working using the rosetta method. I uninstalled all my node/nvm then reinstalled in a rosetta terminal, reselected node 12 (I don't think I ever got 10 to work), and then restarted my terminal if I recall... and I think that's what ended up working. took me like 2 days to get the right combination. yay apple.
hope that helps!
This wouldn't be an issue if they would migrate away from deprecated node-sass and use dart-sass (sass
on npm) which even node-sass says to use now
A few tips for M1 Mac folks... add these to your .zshrc
(no need to have duplicated shells)
# aliases
alias x86="arch -x86_64 zsh"
alias arm="arch -arm64 zsh"
- Open a terminal and install homebrew in ARM mode
- install NVM (not via brew)
- switch to x86 mode and install homebrew again
- When using node (less than v15) don't use ARM mode since prebuilt binaries do not exist (node-sass etc)