Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt Cannot find module 'coffee-script'

I used the following commands to install a mean stack and create an app:

> sudo npm install -g meanio@latest // Get the mean cmdline
> mean init myApp // create your first app
> cd myApp && npm install // Install dependencies
> grunt // Launch mean

but when I get to the final grunt command I get the error:

module.js:333 throw err; ^ Error: Cannot find module 'coffee-script' at Function.Module._resolveFilename (module.js:331:15) at Function.Module._load (module.js:273:25) at Module.require (module.js:357:17) at require (module.js:373:17) at Object.<anonymous> (/home/eddie/ResFour/node_modules/grunt/lib/grunt.js:16:1)

I've tried various solutions on stackoverflow to no avail:

NodeJS - setting up mean.io cannot find module errors

Cannot find module 'coffee-script'

I also cleared npm cache and reinstalled a few times.

like image 238
Eduardo Dennis Avatar asked May 13 '14 03:05

Eduardo Dennis


2 Answers

  1. Remove node_modules directory.
  2. npm cache clean to empty downloaded temporary dependencies, just in case.
  3. npm install again, and better not to interrupt it while running.

These solved most of these problems for me.

like image 191
wilbeibi Avatar answered Nov 07 '22 05:11

wilbeibi


This worked for me:

npm install --save-dev coffee-script
node -v # v0.10.31
like image 2
lfender6445 Avatar answered Nov 07 '22 06:11

lfender6445