Dhiresh Budhiraja
Dhiresh Budhiraja

Reputation: 2725

Error: ENOENT: no such file or directory, scandir

I scaffold an app using jhipster which is microservice gateway using cassandra db and using maven to build which was building fine after scaffold.i ran gulp command to for the live reload of ui.

i made a change slighlty in navbar and home page of it. which was also working file & made some changes in the json files of home & navbar & do some minor changes as adding the search box and other.

it failed to reload. I stop the gulp & maven & restarted them. maven is building but again not loading the site in localhost

when i ran gulp it is showing me this error.

 gulp
fs.js:952
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:952:18)
    at Object.getInstalledBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/extensions.js:121:13)
    at foundBinariesList (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Could anyone tell me solution for this

Upvotes: 185

Views: 254441

Answers (13)

Shehan Hasintha
Shehan Hasintha

Reputation: 1175

rebuild node-sass or just reinstall everything in case node-sass rebuild of doesn't work.

npm rebuild node-sass

or

rm -rf node_modules && npm install

or

npm rebuild

or

npm ci

or just delete node_modules manually and package-lock.json and run npm i

Upvotes: 11

Rajitha Bhanuka
Rajitha Bhanuka

Reputation: 842

I did the below code,

sudo npm rebuild node-sass
mvn clean install

Upvotes: 1

user1324418
user1324418

Reputation: 395

  1. delete the node-sass folder from node\npm-cache
  2. npm rebuild node-sass

Upvotes: 1

Devin Haslam
Devin Haslam

Reputation: 759

I just fixed this error. It was because I was trying to run the project from the wrong folder.

Upvotes: 7

Anurag Manikkame
Anurag Manikkame

Reputation: 837

Here's what worked for me

$npm update
$npm install
$node node_modules/node-sass/scripts/install.js
$npm rebuild node-sass

Upvotes: 51

Shikhara
Shikhara

Reputation: 11

No need to delete node modules, its because of your sass-loader version is different

  1. Delete package-lock.json
  2. npm uninstall node-sass --save
  3. npm i node-sass --save

Upvotes: 1

Fes9L
Fes9L

Reputation: 466

For my case it helps only after doing this command:

node node_modules/node-sass/scripts/install.js

And then there will be /node_modules/node-sass/vendor folder

Upvotes: 11

Shapur
Shapur

Reputation: 577

Some files may not be available in the local version of NodeJS, and sometimes NodeJS does not send a message about it. In this case --force is helpful.

npm install node-sass --force

or

npm rebuild node-sass --force

Upvotes: 7

shah
shah

Reputation: 81

Make sure you have the config.json file. Then do the npm install and npm start.

This might give this error if you don't have this config file.

Upvotes: 1

yugantar kumar
yugantar kumar

Reputation: 2052

It is a problem with older version of node-sass. It doesn't create vendor folder in node_modules/node-sass. I have updated the version of node-sass and it worked fine for me.

My older version of node-sass was 3.1.0

I simply did:

npm install [email protected]

This should solve your problem as well.

Upvotes: 4

Richardson. M
Richardson. M

Reputation: 932

Update your gulp-sass in package.json with new version

"gulp-sass": "3.1.0" // 3.1.0 or later 

This is the link which i follow https://github.com/dlmanning/gulp-sass/issues/508

Upvotes: 0

Patrycja Rychlik
Patrycja Rychlik

Reputation: 61

The vendor directory is created during npm install. Try deleting your node_modules and running npm install.

Upvotes: 4

David Wickstrom
David Wickstrom

Reputation: 5198

I sometimes also get this error when starting my gulp server. My workaround is to just run:

npm rebuild node-sass

And then gulp starts nicely afterward.

Upvotes: 430

Related Questions