Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run stencil start due to libsass error #399

Closed
abrambailey opened this issue Jul 30, 2018 · 15 comments
Closed

Can't run stencil start due to libsass error #399

abrambailey opened this issue Jul 30, 2018 · 15 comments

Comments

@abrambailey
Copy link

abrambailey commented Jul 30, 2018

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:

@karen-white
Copy link
Contributor

Could you try npm rebuild @bigcommerce/node-sass?

@abrambailey
Copy link
Author

➜  cornerstone git:(master) ✗ npm rebuild @bigcommerce/node-sass -verbose
npm info it worked if it ends with ok
npm verb cli [ '/Users/abrambailey/.nvm/versions/node/v7.9.0/bin/node',
npm verb cli   '/Users/abrambailey/.nvm/versions/node/v7.9.0/bin/npm',
npm verb cli   'rebuild',
npm verb cli   '@bigcommerce/node-sass',
npm verb cli   '-verbose' ]
npm info using npm@5.5.1
npm info using node@v7.9.0
npm info readInstalled object
npm verb exit [ 0, true ]
npm info ok
➜  cornerstone git:(master) ✗ stencil start
(node:35394) 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)

@aisflat439
Copy link

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 the stencil-cli, then stencil start bypasses this issue.

@abrambailey
Copy link
Author

Weird, this is on the home page of this project

Note: Stencil requires the Node.js runtime environment, version 4.x through 7.x.

Will try it out...

@abrambailey
Copy link
Author

Wow, it worked. OK. Documentation!!!

@karen-white
Copy link
Contributor

Good catch @abrambailey ! We've updated the required node versions in the official docs, but missed the GitHub README. We'll get this updated.

@abrambailey
Copy link
Author

Screenshot taken just now:

image

@karen-white
Copy link
Contributor

Hey @abrambailey , yes the documentation in your screenshot is correct. Node version 4.x is deprecated, but 6.x + should be fine. To clarify, stencil CLI will work with node v 8.x, but it isn't a requirement. I think resolving your error was due more to reinstalling stencil CLI and npm dependencies than upgrading to node 8.x, but if you're running into the same error with 7.9.0 after reinstalling CLI/npm dependencies please let me know

@abrambailey
Copy link
Author

Ok, thank you Karen. 8 seems to be running fine for now, but will let you know if I need to go back to 7.9.0 if there are any issues.

@ghost
Copy link

ghost commented Aug 9, 2019

I installed everything and tried to start stencil and received this same error. I tried to rebuild it, remove it and reintall it but am still getting the same error. Do I need to uninstall everything and start over or is there an easier way? Can someone clarify the order of installation?

@aisflat439
Copy link

aisflat439 commented Aug 10, 2019

@rosandrest What is "likely" happening here is that you have a version of Node installed that's handling node-sass and a version of the stencil-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:

  • Remove all traces of node on your system.
  • install NVM (notes about NVM below)
  • install a version of node, using NVM (I'm currently using 8.16.0)
  • now install the stencil-cli globally
  • now pull down the stencil theme for your store (or clone cornerstone)
  • type nvm list in your console. Make sure you're using 8.16.0
  • run npm install (if you have node_modules in your theme already you must remove it, then reinstall)
  • run stencil start

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 installed npm install -g stencil-cli you'd get the stencil-cli in that folder. If then do nvm 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!

@ak-mat-development
Copy link

Hey Guys, running into the same problem only I'm running on v10.16.3

`$ stencil start
(node:8148) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
C:\Users\thoyt\AppData\Roaming\npm\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 C:\Users\thoyt\AppData\Roaming\npm\node_modules@bigcommerce\stencil-cli\node_modules@bigcommerce\node-sass\vendor\win32-x64-64\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 (C:\Users\thoyt\AppData\Roaming\npm\node_modules@bigcommerce\stencil-cli\node_modules@bigcommerce\node-sass\lib\extensions.js:158:11)
at Object. (C:\Users\thoyt\AppData\Roaming\npm\node_modules@bigcommerce\stencil-cli\node_modules@bigcommerce\node-sass\lib\index.js:16:36)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (C:\Users\thoyt\AppData\Roaming\npm\node_modules@bigcommerce\stencil-cli\node_modules@bigcommerce\stencil-styles\lib\styles.js:7:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)'

I've tried everything you've instructed. If you could advise.

@ak-mat-development
Copy link

Using windows npm 10.16.3*

@aisflat439
Copy link

Hi @ak-mat-development! I haven't worked on a stencil site in a bit. But at a glance, that looks like the exact issue that most people are encountering when they end up here. My best suggestion, given that you're on widows, is install WSL, then install NVM, then use NVM to install a node version (10+ should be good), then from there you should be fresh.

The following line makes me think that your attempts at uninstalling node may have been in vain.

C:\Users\thoyt\AppData\Roaming\npm\node_modules@bigcommerce\stencil-cli\node_modules@bigcommerce\node-sass\vendor\win32-x64-64\binding.node

Step one is vital, completely uninstall any trace of node on your system. Then install NVM and get node through that path. Then when you install a global package (like stencil-cli) you'll be able to find it's files in an .nvm directory.

Here's a helpful link that doesn't really explain why, but sort of shows where things "should" be installed.
https://flaviocopes.com/where-npm-install-packages/

@junedkazi
Copy link
Contributor

This is over 6 months old so I am going to close it. I would recommend you please try the latest 3.x version and please open a new issue if you run into any issues.

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

No branches or pull requests

5 participants