node-sass: Error: ENOENT: no such file or directory, scandir '**/node_modules/node-sass/vendor'
Followed the troubleshooting guide. I’m having an intermittent build issue with one of our projects. The appearance is that it happens randomly.
See comment for solution
I’m using gulp-sass@2.1.0 which has this as a dependency.
I suspect there might be some sort of concurrency issue with the download of binaries in that specific folder. I’ve tried switching to several different node and npm versions now to see if the problem is related but hasn’t resolved the issue.
Node v4.4.5
NPM 3.5.3
{ http_parser: '2.5.2',
node: '4.4.5',
v8: '4.5.103.35',
uv: '1.8.0',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '46',
openssl: '1.0.2h' }
linux
x64
Ubuntu 16.04
On builds that do run successfully, I’ll get the following message before NPM quits
Binary downloaded and installed at /home/jenkins/development/node_modules/node-sass/vendor/linux-x64-46/binding.node
"/home/jenkins/development/node_modules/node-sass/vendor/linux-x64-46/binding.node" exists.
testing binary.
Binary is fine; exiting.
Otherwise this error will happen during the build
[01:09:46] 'sass' errored after 16 ms
[01:09:46] Error: ENOENT: no such file or directory, scandir '/home/jenkins/development/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.getInstalledBinaries (/home/jenkins/development/node_modules/node-sass/lib/extensions.js:74:13)
at foundBinariesList (/home/jenkins/development/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/home/jenkins/development/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/home/jenkins/development/node_modules/node-sass/lib/errors.js:45:5)
at Object.<anonymous> (/home/jenkins/development/node_modules/node-sass/lib/index.js:14:28)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run-script" "build"
npm ERR! node v4.4.5
npm ERR! npm v3.5.3
npm ERR! code ELIFECYCLE
npm ERR! lexi@1.0.0 build: `gulp testfail lintfail babel sass hb`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lexi@1.0.0 build script 'gulp testfail lintfail babel sass hb'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lexi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp testfail lintfail babel sass hb
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs lexi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls lexi
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/jenkins/development/npm-debug.log
Gulp Sass installation doesn’t seem to be catching the Vendor binaries every time even manually installing.
sudo npm install gulp-sass
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
- lru-cache@4.0.1 node_modules/cross-spawn-async/node_modules/lru-cache
lexi@1.0.0 /home/jenkins/development
├─┬ gulp@3.9.1
│ └─┬ vinyl-fs@0.3.14
│ └─┬ glob-watcher@0.0.6
│ └─┬ gaze@0.5.2
│ └─┬ globule@0.1.0
│ └─┬ minimatch@0.2.14
│ └── lru-cache@2.7.3
├─┬ gulp-sass@2.3.1
│ └─┬ node-sass@3.7.0
│ ├─┬ cross-spawn-async@2.2.4
│ │ └── lru-cache@4.0.1
│ ├─┬ gaze@1.0.0
│ │ └─┬ globule@0.2.0
│ │ └─┬ minimatch@0.2.14
│ │ └── lru-cache@2.7.3
│ └─┬ node-gyp@3.3.1
│ └─┬ minimatch@1.0.0
│ └── lru-cache@2.7.3
├─┬ jshint@2.9.2
│ └─┬ cli@0.6.6
│ └─┬ glob@3.2.11
│ └─┬ minimatch@0.3.0
│ └── lru-cache@2.7.3
└─┬ mocha@2.5.3
└─┬ glob@3.2.11
└─┬ minimatch@0.3.0
└── lru-cache@2.7.3
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN enoent ENOENT: no such file or directory, open '/home/jenkins/development/node_modules/languages.css/package.json'
mike@lexi3:/home/jenkins/development$ ls node_modules/node-sass/
bin binding.gyp lib node_modules package.json README.md scripts src
But installing node-sass manually seems to force the binaries to get downloaded
mike@lexi3:/home/jenkins/development$ sudo npm install node-sass@3.4.2
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
> node-sass@3.4.2 install /home/jenkins/development/node_modules/node-sass
> node scripts/install.js
Binary downloaded and installed at /home/jenkins/development/node_modules/node-sass/vendor/linux-x64-46/binding.node
> spawn-sync@1.0.15 postinstall /home/jenkins/development/node_modules/spawn-sync
> node postinstall
> node-sass@3.4.2 postinstall /home/jenkins/development/node_modules/node-sass
> node scripts/build.js
` /home/jenkins/development/node_modules/node-sass/vendor/linux-x64-46/binding.node ` exists.
testing binary.
Binary is fine; exiting.
- lru-cache@4.0.1 node_modules/cross-spawn-async/node_modules/lru-cache
- minimatch@3.0.0 node_modules/node-sass/node_modules/glob/node_modules/minimatch
- glob@7.0.3 node_modules/node-sass/node_modules/glob
- minimatch@0.3.0 node_modules/node-sass/node_modules/globule/node_modules/glob/node_modules/minimatch
- glob@3.2.11 node_modules/node-sass/node_modules/globule/node_modules/glob
- lodash@2.4.2 node_modules/node-sass/node_modules/lodash
- minimatch@0.2.14 node_modules/node-sass/node_modules/minimatch
- globule@0.2.0 node_modules/node-sass/node_modules/globule
- gaze@1.0.0 node_modules/node-sass/node_modules/gaze
- in-publish@2.0.0 node_modules/in-publish
lexi@1.0.0 /home/jenkins/development
├─┬ babel-cli@6.9.0
│ └─┬ request@2.72.0
│ └─┬ bl@1.1.2
│ └── readable-stream@2.0.6
├─┬ gulp-autoprefixer@3.1.0
│ └─┬ through2@2.0.1
│ └── readable-stream@2.0.6
├─┬ jshint@2.9.2
│ └─┬ cli@0.6.6
│ └─┬ glob@3.2.11
│ └─┬ minimatch@0.3.0
│ └── lru-cache@2.7.3
├─┬ mocha@2.5.3
│ └─┬ glob@3.2.11
│ └─┬ minimatch@0.3.0
│ ├── lru-cache@2.7.3
│ └── sigmund@1.0.1
└─┬ node-sass@3.4.2
├─┬ cross-spawn@2.2.3
│ ├─┬ cross-spawn-async@2.2.4
│ │ └── lru-cache@4.0.1
│ └─┬ spawn-sync@1.0.15
│ ├─┬ concat-stream@1.5.1
│ │ ├── readable-stream@2.0.6
│ │ └── typedarray@0.0.6
│ └── os-shim@0.1.3
├─┬ gaze@0.5.2
│ └─┬ globule@0.1.0
│ └─┬ minimatch@0.2.14
│ ├── lru-cache@2.7.3
│ └── sigmund@1.0.1
├─┬ node-gyp@3.3.1
│ └─┬ minimatch@1.0.0
│ └── lru-cache@2.7.3
└─┬ npmconf@2.1.2
├─┬ config-chain@1.1.10
│ └── proto-list@1.2.4
└── uid-number@0.0.5
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN enoent ENOENT: no such file or directory, open '/home/jenkins/development/node_modules/languages.css/package.json'
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 57
- Comments: 60 (5 by maintainers)
Commits related to this issue
- Add 'enact' install script to ensure node_sass module gets installed Node-sass-middleware has a dependency module, node-sass, which needs to get installed first. Unfortunately, for some reason, the c... — committed to shareonbazaar/bazaar by rmacqueen 8 years ago
- Add 'enact' install script to ensure node_sass module gets installed Node-sass-middleware has a dependency module, node-sass, which needs to get installed first. Unfortunately, for some reason, the c... — committed to shareonbazaar/bazaar by rmacqueen 8 years ago
- Fix failing build with "npm WARN reflux@0.3.1 requires a peer of react@>=0.12.2 <0.15.0 but none was installed." - added 'npm rebuild node-sass'. For more information: https://github.com/sass/node-sa... — committed to vmware-archive/admiral by gmuleshkov 8 years ago
- Fix failing build with "npm WARN reflux@0.3.1 requires a peer of react@>=0.12.2 <0.15.0 but none was installed." - added 'npm rebuild node-sass'. For more information: https://github.com/sass/node-sa... — committed to vmware-archive/admiral by gmuleshkov 8 years ago
- Try telling npm to rebuild node-sass This is a weird bug. See link below for details. https://github.com/sass/node-sass/issues/1579 — committed to godreams/admin-server by harigopal 7 years ago
- Pushing new release to get Herok working SCSS wasn't the issue... seems to be a yarn buiding issue on Heroku: https://github.com/sass/node-sass/issues/1579 https://github.com/yarnpkg/yarn/issues/1832 — committed to ashleydb/ReactTodo by deleted user 7 years ago
- node-sass not installing its vendor dir? see https://github.com/sass/node-sass/issues/1579 — committed to 100ideas/vue-apollo-bug by 100ideas 7 years ago
- Rebuild node-sass on each travis build See: https://github.com/sass/node-sass/issues/1579#issuecomment-227661284 — committed to Holi0317/bridge-calc by Holi0317 7 years ago
- Rebuild node-sass on post-install To address https://github.com/sass/node-sass/issues/1579 Issue: BMS-3597 Reviewer: None — committed to IntegratedBreedingPlatform/Workbench by nahuel-soldevilla 7 years ago
- Rebuildear node-sass. Because node sass is fucking shit. ( https://github.com/sass/node-sass/issues/1579 ) — committed to UTNianos/frontend by deleted user 7 years ago
- force yarn install before test build This should take care of CI builds failing because of https://github.com/sass/node-sass/issues/1579#issuecomment-227663782 — committed to hotzeplotz/pattrn by deleted user 7 years ago
- rebuild node-sass for https://github.com/sass/node-sass/issues/1579 — committed to ember-learn/ember-api-docs by hone 7 years ago
- rebuild node-sass for https://github.com/sass/node-sass/issues/1579 — committed to ember-learn/ember-api-docs by hone 7 years ago
- rm unecessary call to `yarn --pure-lockfile` in before_deploy There's no need to reinstall packages in the before_deploy section of the Travis build, and that second call is causing a build error due... — committed to cloud-gov/pages-core by deleted user 7 years ago
- fix(build): fix node-sass vendor issue See sass/node-sass#1579 and sass/node-sass#1812 — committed to adab1ts/veinapp by zuzust 7 years ago
- fix(build): fix node-sass vendor issue See sass/node-sass#1579 and sass/node-sass#1812 — committed to adab1ts/veinapp by zuzust 7 years ago
- fix(build): fix node-sass vendor issue See sass/node-sass#1579 and sass/node-sass#1812 — committed to adab1ts/veinapp by zuzust 7 years ago
- chore(heroku): fix the node-sass/heroku deployment issue re https://github.com/sass/node-sass/issues/1579 — committed to artemv/rollout_dashboard by artemv 7 years ago
- chore(heroku): fix the node-sass/heroku deployment issue re https://github.com/sass/node-sass/issues/1579 — committed to artemv/rollout_dashboard by artemv 7 years ago
- Fix the Travis build Docker controls the environment. By specifying Node, Travis automatically install npm modules, which then causes issues if the Docker version of Node is different. So let's juse ... — committed to dguo/dailylore by dguo 7 years ago
Just to update from my end. I found that for some reason no matter what I did even after the permissions issue was resolved, it still wouldn’t always run the install.js script. I also noticed it tends to happen when its only part of a large set of downloads.
As a safe guard, I just started running the install.js file after NPM Install command part of my build. This ensured that the vendor folder was always present.
Can’t explain why the install file doesn’t always get ran on each build. So my build script looks like this:
npm updatenpm installnodejs node_modules/node-sass/scripts/install.jsnpm rebuild node-sassnpm will only execute install scripts for direct dependencies in your package.json. This is a performance optimisation on their end which is unfortunate.
npm rebuild node-sassis the official solution. Deleting your node_modules and runningnpm installwill also do the trick.This commonly happens in CI systems because they’ll typically run
npm installwith the default OS Node. Later in their script they’ll switch a new version of Node. Native extension are compiled against the version of Node thatnpmwas using during install. This means the new Node cannot see the extension built during install.In this case, running
npm installagain doesn’t fix the issue because npm thinks it is installed. This is why you must runnpm rebuild node-sass.@peterpme I was able to fix this on heroku by turning off
NODE_MODULES_CACHEheroku config:set NODE_MODULES_CACHE=falsenpm rebuild node-sassI have same problem, run
npm rebuild node-sassresolve it.npm rebuild node-sassfixed the issue for me.The vendor directory is created during npm install. Try deleting your node_modules and running npm install. On 22 Jun 2016 2:02 AM, “dustin-page” notifications@github.com wrote:
Hi everybody,
When deploying to Heroku, I continue to have this issue even after running
npm rebuild node-sass. Does anybody else feel the same way?It appears that there was a permissions issue running install.js.
I’m not sure why it was doing it intermittently, but I simply changed the access rights to the build folder.
NPM seems to not give you a notification if install.js fails to run correctly.
I had this issue trying to deploy to Heroku after I started to import some css inside JS packs with Webpacker which uses Yarn.
npm rebuild node-sassdid help, and one way to make it work during Heroku deployment is to put this to package.json:npm rebuild node-sass
I have same problem, run npm rebuild node-sass resolve it.
I have the same problem, and after: sudo npm rebuild node-sass It was the solution to the problem…
We’ve just started having this issue intermittently on our build servers using Yarn 0.18.1. Our build was previously stable; we’re having a hard time figuring out what’s changed. Just posting here in case anyone else is also suddenly encountering this issue too.
Update: Our problem seems to be https://github.com/yarnpkg/yarn/issues/1832
@mrking
I ran this for every package that gave ENOENT and now everything if working. thanks alot!
for some reason the install script wasn’t invoked when i ran
npm installUse npm install node-sass or Linux npm install node-sass --no-bin-links
This problem was happening on a build server where the folder was clean on each build. So your suggestion of deleting the node_modules folder didn’t fix the issue in my case as there wasn’t a node_modules folder to begin with.
I don’t know enough about how NPM works to comment on your bit of information. If you want me to do any additional logging, I can still reproduce the problem fairly consistently. However, I have my work around for now 👍
However, seeing no one else has reported this until now, whatever it is, its not widespread. Probably not good utilization of time.
npm rebuild node-sassresolved it for me too.Every 19 out of 20 deployments on heroku for my apps that use this package simply crash due to this problem 😃 I keep pushing the same commit until Heroku builds it. That seems to be the only solution right now, yes? Rebuild until it works?
Vagrant box can use:
npm rebuild node-sass --no-bin-linksThank for this topic.Simlar problem with node-sass v3.7.0. I get the following error: Error: ENOENT: no such file or directory, scandir ‘C:\Working\my-app\node-sass\vendor’
In the package.json file it is looking for the “vendor” directory, which doesn’t exist:
“files”: [ “bin”, “binding.gyp”, “lib”, “scripts”, “src”, “vendor” ],
Rolling back “node-sass” to “3.4.0” temporarily fixed the issue for me. However, I am now locked into this version.
Same issue suddenly appeared magically in Dockerfile builds. Downgraded npm 6.6 to 6.5 and then it worked again.
The workaround fix by @devmedios worked for our Docker CI pipeline. 😅
npm i node-sass --no-bin-linksThanks!This problem started appearing after rebuilding our docker image today (no change to Dockerfile content), reverting back to old docker image works.
the docker file looks like this:
so the problem is one of the following:
The weird thing is, even after fixing the version of yarn and lerna, the problem still exists:
node-sass & bug
solution
OR
I had the same issue. My installed version for
node-sasswas3.1.0. I upgraded it to3.7.0which containsvendor filesand now it is working fine.Deleting
node_modules/node-sassand reinstalling didn’t seem to work for me. @ERPedersen’s solution worked.I ran into this problem with node 8.5.0 and node-sass 4.5.3. Fixed it by deleting the
node_modules/node-sassdirectory and reinstalling.But exactly what is the cause of the problem?
Thank you @mrking, simply
npm rebuild node-sassdid the trick here (MacOS)@pencilcheck - I was running into the same issue. Add
npm rebuild node-sass &&
Before your build/start script for heroku and it’ll recompile node sass before building your app packages.
The only thing I had to do on TravisCi was:
After that it worked, thanks
npm rebuild works sometimes. The only thing that always works for me to get rid of this ridiculous annoying bug is to just go npm install node-sass@random-compatible-different-version
Had the same problem. After running
npm updateEverything worked fine