stencil-cli icon indicating copy to clipboard operation
stencil-cli copied to clipboard

Please help solve issue with errors related to node-sass when running npm install

Open mrosswog opened this issue 1 year ago β€’ 14 comments

Hello, any guidance on the issues below would be greatly appreciated.

Last year we updated our theme to get rid of any incompatible scss, and were able to go the rest of 2024 with routine updates, no problems.

For 2025 we are revamping our theme, and I am starting with a new, downloaded copy of the theme files.

I completely uninstalled and re-installed the correct versions of nvm, npm, and node.js, as well as BigCommerce Stencil CLI.

I see that BC now says Python is required, so I downloaded Python 3.13.1, installed and configured my .zshrc file.

When I run npm install in my theme directory, I get some confusing error messages. There is a set of messages about node-sass, and later some about node-gyp and python:

npm error code 1 npm error git dep preparation failed npm error command /Users/xxxxxxxxxxxxxx/.nvm/versions/node/v20.16.0/bin/node /Users/xxxxxxxxxxxxxx/.nvm/versions/node/v20.16.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/xxxxxxxxxxxxxx/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run npm error npm warn using --force Recommended protections disabled. npm error npm warn ERESOLVE overriding peer dependency npm error npm warn While resolving: [email protected] npm error npm warn Found: [email protected] npm error npm warn node_modules/node-sass npm error npm warn dev node-sass@"^9.0.0" from the root project npm error npm warn npm error npm warn Could not resolve dependency: npm error npm warn peer node-sass@"^3.4.2" from [email protected] npm error npm warn node_modules/sass-loader npm error npm warn dev sass-loader@"^3.2.0" from the root project npm error npm warn npm error npm warn Conflicting peer dependency: [email protected] npm error npm warn node_modules/node-sass npm error npm warn peer node-sass@"^3.4.2" from [email protected] npm error npm warn node_modules/sass-loader npm error npm warn dev sass-loader@"^3.2.0" from the root project npm error npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs npm error npm warn deprecated [email protected]: πŸ™Œ Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update! npm error npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs npm error npm warn deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm error npm warn deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated npm error npm warn deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm error npm warn deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated npm error npm warn deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash. npm error npm warn deprecated [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 npm error npm warn deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm error npm warn deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm error npm warn deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x. npm error npm warn deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. npm error npm error code 1 npm error npm error path /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass npm error npm error command failed npm error npm error command sh -c node scripts/build.js npm error npm error Building: /Users/xxxxxxxxxxxxxx/.nvm/versions/node/v20.16.0/bin/node /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm error npm error c++ -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/include/node -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/src -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/deps/openssl/config -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/deps/openssl/openssl/include -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/deps/uv/include -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/deps/zlib -I/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/deps/v8/include -I../src/libsass/include -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -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 npm error npm error gyp info it worked if it ends with ok npm error npm error gyp verb cli [ npm error npm error gyp verb cli '/Users/xxxxxxxxxxxxxx/.nvm/versions/node/v20.16.0/bin/node', npm error npm error gyp verb cli '/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/bin/node-gyp.js', npm error npm error gyp verb cli 'rebuild', npm error npm error gyp verb cli '--verbose', npm error npm error gyp verb cli '--libsass_ext=', npm error npm error gyp verb cli '--libsass_cflags=', npm error npm error gyp verb cli '--libsass_ldflags=', npm error npm error gyp verb cli '--libsass_library=' npm error npm error gyp verb cli ] npm error npm error gyp info using [email protected] npm error npm error gyp info using [email protected] | darwin | x64 npm error npm error gyp verb command rebuild [] npm error npm error gyp verb command clean [] npm error npm error gyp verb clean removing "build" directory npm error npm error gyp verb command configure [] npm error npm error gyp verb find Python Python is not set from command line or npm configuration npm error npm error gyp verb find Python checking Python explicitly set from environment variable PYTHON npm error npm error gyp verb find Python - process.env.PYTHON is "/usr/bin/python3" npm error npm error gyp verb find Python - executing "/usr/bin/python3" to get executable path npm error npm error gyp verb find Python - executable path is "/Library/Developer/CommandLineTools/usr/bin/python3" npm error npm error gyp verb find Python - executing "/Library/Developer/CommandLineTools/usr/bin/python3" to get version npm error npm error gyp verb find Python - version is "3.9.6" npm error npm error gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3" npm error npm error gyp verb get node dir no --target version specified, falling back to host node version: 20.16.0 npm error npm error gyp verb command install [ '20.16.0' ] npm error npm error gyp verb install input version string "20.16.0" npm error npm error gyp verb install installing version: 20.16.0 npm error npm error gyp verb install --ensure was passed, so won't reinstall if already installed npm error npm error gyp verb install version is already installed, need to check "installVersion" npm error npm error gyp verb got "installVersion" 11 npm error npm error gyp verb needs "installVersion" 9 npm error npm error gyp verb install version is good npm error npm error gyp verb get node dir target node version installed: 20.16.0 npm error npm error gyp verb build dir attempting to create "build" dir: /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass/build npm error npm error gyp verb build dir "build" dir needed to be created? Yes npm error npm error gyp verb build/config.gypi creating config file npm error npm error gyp verb build/config.gypi writing out config file: /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass/build/config.gypi npm error npm error gyp verb config.gypi checking for gypi file: /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass/config.gypi npm error npm error gyp verb common.gypi checking for gypi file: /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass/common.gypi npm error npm error gyp verb gyp gyp format was not specified; forcing "make" npm error npm error gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3 npm error npm error gyp info spawn args [ npm error npm error gyp info spawn args '/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/gyp/gyp_main.py', npm error npm error gyp info spawn args 'binding.gyp', npm error npm error gyp info spawn args '-f', npm error npm error gyp info spawn args 'make', npm error npm error gyp info spawn args '-I', npm error npm error gyp info spawn args '/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass/build/config.gypi', npm error npm error gyp info spawn args '-I', npm error npm error gyp info spawn args '/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/addon.gypi', npm error npm error gyp info spawn args '-I', npm error npm error gyp info spawn args '/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/include/node/common.gypi', npm error npm error gyp info spawn args '-Dlibrary=shared_library', npm error npm error gyp info spawn args '-Dvisibility=default', npm error npm error gyp info spawn args '-Dnode_root_dir=/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0', npm error npm error gyp info spawn args '-Dnode_gyp_dir=/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp', npm error npm error gyp info spawn args '-Dnode_lib_file=/Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0/<(target_arch)/node.lib', npm error npm error gyp info spawn args '-Dmodule_root_dir=/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass', npm error npm error gyp info spawn args '-Dnode_engine=v8', npm error npm error gyp info spawn args '--depth=.', npm error npm error gyp info spawn args '--no-parallel', npm error npm error gyp info spawn args '--generator-output', npm error npm error gyp info spawn args 'build', npm error npm error gyp info spawn args '-Goutput_dir=.' npm error npm error gyp info spawn args ] npm error npm error gyp verb command build [] npm error npm error gyp verb build type Release npm error npm error gyp verb architecture x64 npm error npm error gyp verb node dev dir /Users/xxxxxxxxxxxxxx/Library/Caches/node-gyp/20.16.0 npm error npm error gyp verb which succeeded for make /usr/bin/make npm error npm error gyp info spawn make npm error npm error gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ] npm error npm error In file included from ../src/libsass/src/ast.cpp:1: npm error npm error ../src/libsass/src/sass.hpp:49:10: fatal error: 'string' file not found npm error npm error 49 | #include npm error npm error | ^~~~~~~~ npm error npm error 1 error generated. npm error npm error make: *** [Release/obj.target/libsass/src/libsass/src/ast.o] Error 1 npm error npm error gyp ERR! build error npm error npm error gyp ERR! stack Error: make failed with exit code: 2 npm error npm error gyp ERR! stack at ChildProcess.onExit (/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/lib/build.js:194:23) npm error npm error gyp ERR! stack at ChildProcess.emit (node:events:519:28) npm error npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) npm error npm error gyp ERR! System Darwin 23.6.0 npm error npm error gyp ERR! command "/Users/xxxxxxxxxxxxxx/.nvm/versions/node/v20.16.0/bin/node" "/Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm error npm error gyp ERR! cwd /Users/xxxxxxxxxxxxxx/.npm/_cacache/tmp/git-cloneHmBVytDavkmn/node_modules/node-sass npm error npm error gyp ERR! node -v v20.16.0 npm error npm error gyp ERR! node-gyp -v v8.4.1 npm error npm error gyp ERR! not ok npm error npm error Build failed with error code: 1 npm error npm error A complete log of this run can be found in: /Users/xxxxxxxxxxxxxx/.npm/_logs/2025-01-08T19_25_36_434Z-debug-0.log npm error A complete log of this run can be found in: /Users/xxxxxxxxxxxxxx/.npm/_logs/2025-01-08T19_25_17_966Z-debug-0.log

mrosswog avatar Jan 08 '25 19:01 mrosswog

Hi @mrosswog Do you have setuptools installed? Screenshot 2025-01-10 at 10 11 05

jairo-bc avatar Jan 10 '25 09:01 jairo-bc

yes, unless i did this wrong:

python3 -m pip install setuptools Collecting setuptools Downloading setuptools-75.6.0-py3-none-any.whl.metadata (6.7 kB) Downloading setuptools-75.6.0-py3-none-any.whl (1.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 11.8 MB/s eta 0:00:00 Installing collected packages: setuptools Successfully installed setuptools-75.6.0

mrosswog avatar Jan 13 '25 16:01 mrosswog

The actual error is ./src/libsass/src/sass.hpp:49:10: fatal error: 'string' file not found, that's something new. Are you on Rosetta mode?

jairo-bc avatar Jan 14 '25 17:01 jairo-bc

Thanks for the response No rosetta I am on an Intel Mac I am running Mac OS Sonoma 14.7.2 I installed Python 3 from the Python Website. Then configured an alias in .zshrc to make sure the python command calls up python3.

mrosswog avatar Jan 14 '25 21:01 mrosswog

@mrosswog you may try to use python3 -m venv ~/py_envs source ~/py_envs/bin/activate before installing _ setuptools_

jairo-bc avatar Jan 28 '25 17:01 jairo-bc

Thank you for the tip, but before I try this - I uninstalled version 3.13 of Python so that's now out of the picture.

I have version 3.9 and 2.7 that came with Mac OS. Do I still need to use the command you provided?

I am still experiencing the same problems trying to use the system Python.

Thank you very much

mrosswog avatar Jan 29 '25 23:01 mrosswog

Same issue here: MacOS 15.3.1

EDIT:

This solved it for me

 export CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1

BuruY avatar Mar 05 '25 20:03 BuruY

@BuruY holy shit that worked for me, thank you so much. Many other solutions did not work for me.

macOS 15.3.2, M1 node 16.18.1 node-gyp 7.1.2 python 3.10.13

nshoes avatar Apr 02 '25 02:04 nshoes

Bloody hell, that worked! @BuruY

rawat9 avatar May 30 '25 11:05 rawat9

On OSX 15.5 Sequoia and @BuruY's is the only solutiton that worked for me.

Namone avatar Jun 12 '25 12:06 Namone

I'm using macOS: 15.5 (24F74) and @BuruY's solution saved my life! Thank you!

brendancjz avatar Jun 19 '25 08:06 brendancjz

@BuruY Thank you, this worked for me too on latesst osx and saved me from hours of struggle, on multiple occasions (thankful i put this link in my notes!).

GetBitOutdoors avatar Jul 01 '25 06:07 GetBitOutdoors

@BuruY Could you please share more details on how you got this working? I’ve been stuck for a few hours trying to get Stencil installed again with no luck.

It was working fine yesterday, but today I was prompted to update Stencil. I uninstalled it and ran npm install -g @bigcommerce/stencil-cli, but I keep hitting the same error mentioned above. I’ve tried multiple Node versions (18.17, 20.5, 21.1, 24.3), but no luck so far.

Environment: β€’ macOS 15.5 (M2 chip) β€’ Node: 18.15.0 β€’ Python: 3.12.3

Any insight or tips would be greatly appreciatedβ€”thanks!

anavdesign avatar Jul 01 '25 21:07 anavdesign

Update: I was able to resolve the issue.

I installed the Python setup tools using Homebrew:

brew install python-setuptools

After that, I was able to successfully install Stencil using the latest version of Node.

Environment: β€’ macOS 15.5 (M2 chip) β€’ Node: v24.3.0 β€’ Python: 3.12.3

Thanks! Hope this helps someone else.

anavdesign avatar Jul 01 '25 22:07 anavdesign