Node-sass: /node-sass/vendor no such file or directory in [email protected]

Created on 19 Nov 2016  ·  9Comments  ·  Source: sass/node-sass

I use sass_binary_path to cache my node-sass binary file, and when i install [email protected] ,
it's show Binary found at /Users/blinkyang/test/node-cache/node-sass/darwin-x64-47_binding.node and install success, but if i run this script node -p "require('node-sass').info" it's throw an error below:

Error: ENOENT: no such file or directory, scandir '/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at Object.getInstalledBinaries (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/extensions.js:121:13)
    at foundBinariesList (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/Users/blinkyang/test/tmp/test-node-sass/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

i think it was because the vendor folder doesn't create after check hasBinary

  • NPM version (npm -v): 3.8.6
  • Node version (node -v):v5.11.0
  • Node Process (node -p process.versions):
   { http_parser: '2.7.0',
  node: '5.11.0',
  v8: '4.6.85.31',
  uv: '1.8.0',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '56.1',
  modules: '47',
  openssl: '1.0.2g' }
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
Error: ENOENT: no such file or directory, scandir
  • npm node-sass versions (npm ls node-sass):
[email protected] /Users/blinkyang/test/tmp/test-node-sass
└── [email protected]

Most helpful comment

run npm rebuild node-sass

All 9 comments

@yqb1989 what's the value of sass_binary_path?

@xzyfer
this is my sass_binary_path

bash-3.2$ npm config get sass_binary_path
/Users/blinkyang/test/node-cache/node-sass/darwin-x64-47_binding.node

bash-3.2$ ls /Users/blinkyang/test/node-cache/node-sass/
darwin-x64-47_binding.node

and darwin-x64-47_binding.node was download here

Thanks @yangblink. The bug isn't that vendor hasn't been created, it's that we are trying to load the binding from vendor instead of sass_binary_path.

Turns out this behaviour is on purpose, although a little confusing. The npm config is only available during the execution of npm scripts, like during npm install. It's not available in a normal node process.

In your case you should use the SASS_BINARY_PATH environment variable rather than the npm config variable.

run npm rebuild node-sass

Hi, change your node_modules directory permission...
sudo chmod -R 775 /node_modules

In my case i didnt realize i needed the node-sass package installed, found that it wasnt in my package.json, simply because on the other app i was running it as, had a remnant node-sass/vendors directory in there with a linux file in it, that didnt get correctly uninstalled i presume so I thougth I had all needed dependency's already.

When i switched envs to windows powershell, and ran npm install, the error came up because it didn't have the vendor file it needed any more. Doing a npm install --save-dev node-sass enabled the sass compiling resolving the isssue. I was doing compiling with webpack.

i'm having problems with the way node-sass is installed using yarn: https://github.com/davezuko/react-redux-starter-kit/issues/791#issuecomment-338848223

can anyone advice me what to do here?

Running sudo npm install resolved the issue. So I believe that it was a node_modules dir permission issue. I did not use sudo on build command. this means npm run build was successful.

Was this page helpful?
0 / 5 - 0 ratings