Error: Cannot find module 'gulp-sass'
Asked Answered
A

18

80

When I compile with gulp, I got an error like below. How can I fix it?

module.js:339
throw err;
^
Error: Cannot find module 'gulp-sass'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/flyscoot.com/gulpfile.js:2:12)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
Albuminous answered 24/10, 2015 at 4:39 Comment(0)
D
100

Just do npm update and then npm install gulp-sass --save-dev in your root folder, and then when you run you shouldn't have any issues.

Duplessis answered 6/3, 2016 at 14:32 Comment(2)
i did too, i don't know it's doesn't work cause i have issue permissionFournier
this worked for me as well! Thank you.Brenner
T
25

Edit your package.json. Change:

"gulp-sass": "^2.3.2"

to

"gulp-sass": "3.0.0"

Delete the node_modules folder and run npm install again.

Source: https://github.com/codecombat/codecombat/issues/4430#issuecomment-348927771

Touchy answered 3/10, 2018 at 21:42 Comment(1)
Yes it works. I updated with "gulp-sass": "3.1.0"Gokey
G
24

Did you check this question?

May be possible solution is:

rm -rf node_modules/
npm install
Gadgetry answered 9/11, 2015 at 23:33 Comment(3)
i did it but file cannot deleteFournier
did you try with sudo?Gadgetry
use "rimraf" for deleting node_modulesClute
G
4

I had the same problem, and I resolve doing this npm update. But I receive the message about permission, so I run:

sudo chwon -R myuser /home/myUserFolder/.config

This set permissions for my user run npm comands like administrator. Then I run this again:

npm update 

and this:

npm install gulp-sass

Then my problem with this was solved.

Gat answered 8/1, 2018 at 13:45 Comment(0)
A
4

Try this:

npm install -g gulp-sass

or

npm install --save gulp-sass
Antonyantonym answered 27/8, 2018 at 11:9 Comment(0)
T
3

I had the same problem on my new Windows 10 machine. I had to intall the Windows build tools with npm install -g windows-build-tools. (https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration)

Thermochemistry answered 10/2, 2018 at 15:10 Comment(0)
W
3

i was also facing the same issue, The possible solution is to install the gulp-sass module, but if you will run the below command npm install -g gulp-sass or npm install --save gulp-sass, This is not going to be updated on node-sass project's end.

This version of node-sass is missing (returns a 404) and google web-starter-kit v0.6.5 has depended on it for a long time, since Dec 2016. So, it has been working for a long time and must have just disappeared.

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":

HTTP error 404 Not Found

The only workaround is to upgrade node-sass: npm i gulp-sass@latest --save-dev to fix the issue.

Worker answered 24/9, 2018 at 14:53 Comment(0)
K
3

I had same error on Ubuntu 18.04

Delete your node_modules folder and run

sudo npm install --unsafe-perm=true
Kapp answered 22/1, 2019 at 7:58 Comment(0)
C
3

Make sure python is installed on your machine, Python is required for node-sass.

Cephalopod answered 26/10, 2020 at 5:5 Comment(1)
If I am correct Python 2 is required/has some dependency for the [email protected] version, [email protected] or more will work fine without PythonRothmuller
G
2

I had this issue for days looking for answers. My error log was similar to this npm just won't install node sass The only problem was the node version. Maybe it can help some of you.

I downgraded my Node.js from 9.3.0 to 6.12.2 and run:

npm update
Greaser answered 26/12, 2017 at 18:49 Comment(0)
T
2

In the root folder where package.json is located, run npm outdated. You'll get outdated packages returned with some details. In those details, you'll see the current version number of the outdated package.

After then, open the package.json file and manually change the version number of the corresponding package.

Then delete the node_modules folder and run npm install. It should solve this issue.

Tadio answered 11/10, 2018 at 13:18 Comment(0)
T
1

I ran : npm i gulp-sass@latest --save-dev

That did the magic for me

Tetracaine answered 4/12, 2020 at 17:54 Comment(0)
P
1

Ive faced the same troubles with gulp-sass in my VSCode environment. Also, I was observing a lot of fails during npm installing and I could not start gulp (as outcome). The way how I fixed it:

  • delete packages
  • npm i
  • npm i gulp-sass --save-dev

Now it works.

Pola answered 25/3, 2021 at 19:43 Comment(0)
D
1

I followed the doc to migrating to version 5.

npm install sass gulp-sass --save-dev

It's worked for me

node -v => v19.8.1
npm -v => 9.5.1
Domesticate answered 14/4, 2023 at 14:18 Comment(1)
The npm command worked in Visual Studio Code for me without updating to version 5.Dobby
B
0

Those who are getting this error, please downgrade the Node.js you are using.

  • Step 1 :

    Uninstall the one you are using and install the version you prefer. I installed v6.12.3. My previous Node.js version was v9.4.0.

  • Step 2 :

    Download Node.js.

Hope this will work.

Boudicca answered 24/1, 2018 at 14:5 Comment(0)
C
0

I worked with Yarn and I got the same issue and I solve it doing this:

delete node_modules
yarn install
yarn upgrade
 
yarn add gulp-sass --save-dev
Curtal answered 21/5, 2020 at 22:55 Comment(0)
E
0

Try this to fix the error:

  1. Delete node_modules directory.
  2. Run npm i gulp-sass@latest --save-dev
Exuviae answered 21/12, 2020 at 18:12 Comment(0)
S
0

Solution:

  1. const sass = require('gulp-sass')(require('sass'));
  2. npm install gulp-sass sass
Sanctus answered 25/6, 2022 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.