Error: Cannot find module 'gulp-sass'

2019-01-31 02:21发布

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)

标签: sass npm gulp
11条回答
唯我独甜
2楼-- · 2019-01-31 02:56

Did you check this question?

May be possible solution is:

rm -rf node_modules/
npm install
查看更多
女痞
3楼-- · 2019-01-31 02:58

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)

查看更多
疯言疯语
4楼-- · 2019-01-31 03:03

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.

查看更多
戒情不戒烟
5楼-- · 2019-01-31 03:06

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.

查看更多
smile是对你的礼貌
6楼-- · 2019-01-31 03:10

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

查看更多
7楼-- · 2019-01-31 03:12

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
查看更多
登录 后发表回答