stencil-cli: Can't run stencil start due to libsass error
Rebuilding node-sass
➜ cornerstone git:(master) ✗ npm rebuild node-sass
> node-sass@4.9.2 install /Users/abrambailey/bigcommerce/cornerstone/node_modules/node-sass
> node scripts/install.js
node-sass build Binary found at /Users/abrambailey/bigcommerce/cornerstone/node_modules/node-sass/vendor/darwin-x64-51/binding.node
> node-sass@4.9.2 postinstall /Users/abrambailey/bigcommerce/cornerstone/node_modules/node-sass
> node scripts/build.js
Binary found at /Users/abrambailey/bigcommerce/cornerstone/node_modules/node-sass/vendor/darwin-x64-51/binding.node
Testing binary
Binary is fine
node-sass@4.9.2 /Users/abrambailey/bigcommerce/cornerstone/node_modules/node-sass
Trying to start stencil and being asked to rebuild node-sass
➜ cornerstone git:(master) ✗ stencil start
(node:86424) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
/Users/abrambailey/.nvm/versions/node/v7.9.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/@bigcommerce/node-sass/lib/extensions.js:158
throw new Error([
^
Error: The `libsass` binding was not found in /Users/abrambailey/.nvm/versions/node/v7.9.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/@bigcommerce/node-sass/vendor/darwin-x64-51/binding.node
This usually happens because your node version has changed.
Run `npm rebuild node-sass` to build the binding for your current node version.
at Object.sass.getBinaryPath (/Users/abrambailey/.nvm/versions/node/v7.9.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/@bigcommerce/node-sass/lib/extensions.js:158:11)
at Object.<anonymous> (/Users/abrambailey/.nvm/versions/node/v7.9.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/@bigcommerce/node-sass/lib/index.js:16:36)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/abrambailey/.nvm/versions/node/v7.9.0/lib/node_modules/@bigcommerce/stencil-cli/node_modules/@bigcommerce/stencil-styles/lib/styles.js:7:14)
I tried the following, but nothing helps:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (4 by maintainers)
@rosandrest What is “likely” happening here is that you have a version of Node installed that’s handling
node-sass
and a version of thestencil-cli
installed that was installed by a different version. You may even have changed versions of node while in the same project.The ideal order of things is:
8.16.0
)nvm list
in your console. Make sure you’re using8.16.0
node_modules
in your theme already you must remove it, then reinstall)NVM stands for Node Version Manager. Think of it like a hidden folder that contains everything about a particular node version. So you’d have a file structure like
./nvm/node_versions/8.1.2
and in that folder there would be everything related to that node version. So when you installednpm install -g stencil-cli
you’d get the stencil-cli in that folder. If then donvm install 8.11.0
you’ll be in a separate folder that has no stencil-cli installed. This allows you to manage versions in a more controlled environment and avoids conflicts like you are “most likely” experiencing.Please note: I’m not 100% sure that this will fix your problem (although it’s worked for basically everyone I’ve helped through this, say an n of 6) and some of what I explained above is a simple/rough example of how it works, not “actually” how it works.
Good luck!
This happened to me when I had Node installed globally and NVM to manage versions. For me installing
node 8.x.x
through nvm, then thestencil-cli
, then stencil start bypasses this issue.