question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'node-sass' - Fresh laravel 5.4 install

See original GitHub issue

I just created a fresh Laravel 5.4 project using Laravel Homestead on a Windows machine. I ran npm install successfully, but am running into issues with npm run dev. Here is my output:


Module build failed: Error: Cannot find module 'node-sass'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/vagrant/Code/CSE356/node_modules/sass-loader/index.js:4:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModule.js:129:2)
    at NormalModule.build (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModule.js:180:15)
    at Compilation.buildModule (/home/vagrant/Code/CSE356/node_modules/webpack/lib/Compilation.js:127:10)

 @ ./resources/assets/sass/app.scss 4:14-248
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

 error  in ./resources/assets/sass/app.scss

Module build failed: Error
    at /home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModule.js:141:35
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:170:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:27:11)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/vagrant/Code/CSE356/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModule.js:129:2)
    at NormalModule.build (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModule.js:180:15)
    at Compilation.buildModule (/home/vagrant/Code/CSE356/node_modules/webpack/lib/Compilation.js:127:10)
    at moduleFactory.create (/home/vagrant/Code/CSE356/node_modules/webpack/lib/Compilation.js:404:9)
    at /home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModuleFactory.js:242:4
    at /home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModuleFactory.js:93:13
    at /home/vagrant/Code/CSE356/node_modules/tapable/lib/Tapable.js:204:11
    at NormalModuleFactory.<anonymous> (/home/vagrant/Code/CSE356/node_modules/webpack/lib/CompatibilityPlugin.js:51:4)
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/vagrant/Code/CSE356/node_modules/tapable/lib/Tapable.js:208:13)
    at onDoneResolving (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModuleFactory.js:68:11)
    at onDoneResolving (/home/vagrant/Code/CSE356/node_modules/webpack/lib/NormalModuleFactory.js:189:6)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)

 error

/home/vagrant/Code/CSE356/node_modules/extract-text-webpack-plugin/loader.js?{"id":1,"omit":1,"remove":true}!/home/vagrant/Code/CSE356/node_modules/style-loader/index.js!/home/vagrant/Code/CSE356/node_modules/css-loader/index.js!/home/vagrant/Code/CSE356/node_modules/postcss-loader/index.js!/home/vagrant/Code/CSE356/node_modules/resolve-url-loader/index.js!/home/vagrant/Code/CSE356/node_modules/sass-loader/index.js?sourceMap&precision=8!/home/vagrant/Code/CSE356/resources/assets/sass/app.scss doesn't export content
                                                                                                   Asset      Size  Chunks                    Chunk Names
       /js/app.js   1.16 MB       0  [emitted]  [big]  /js/app
mix-manifest.json  32 bytes          [emitted]

npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/local/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v7.4.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/Code/CSE356/npm-debug.log
vagrant@homestead:~/Code/CSE356$

I have not modified the original package.json or webpack.mix.js files.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15

github_iconTop GitHub Comments

73reactions
JeffreyWaycommented, Jan 30, 2017

It should install node-sass for you automatically, but if it failed for some reason, do:

npm install node-sass
34reactions
sameeranand1commented, Feb 3, 2017

To other people with similar issues, maybe this can help:

I had an issue when running npm install node-sass

So I ran npm install node-sass --no-bin-links and had no issues. Then I was able to run npm run dev with no issues.

Thanks for the help Jeffrey!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'node-sass' - Fresh laravel 5.4 install #226
I just created a fresh Laravel 5.4 project using Laravel Homestead on a Windows machine. I ran npm install successfully, but am running...
Read more >
ERROR in Cannot find module 'node-sass' - Stack Overflow
Whenever you did npm install to the initial installation, the sass module did not get installed, which is why this problem occurs. Share....
Read more >
Cannot find module 'node-sass' error | bobbyhadz
To solve the error "Cannot find module 'node-sass'", make sure to install the node-sass package by opening your terminal in your project's root...
Read more >
laravel 5.4 dev npm run dev error - Laracasts
I tested on a fresh install of laravel and got the same issue. Here is the full log of the issue : Copy...
Read more >
Laravel-mix missing dependencies
I'm trying to update Laravel from 5.3 to 5.4, but I get errors when compiling frontend assets. After installing laravel-mix, npm complains about...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found