Error: cannot find module 'dateformat' in gulp

I work with nodejs (version v4.2.1) I would like to work with gulp I installed gulp (3.9.0) But when I try my default script with an empty function (the script below) using the gulp command I get an error

Error: cannot find module 'dateformat'

I tried to set dateformat using

npm install -g dateformat 

I can verify that dateformat is set using the dateformat --help command But the gulp script creates the same error

Error: cannot find module 'dateformat'

I am working with windows 7

Any help?

====================== script

 var gulp = require('gulp'); gulp.task('default', function() { }); 
+7
windows npm gulp
source share
2 answers

If a similar problem and reinstalling gulp really fixed the problem globally, however , see my details regarding previous node installations (since you also mention this)

 npm uninstall gulp -g npm install gulp -g 

The explanation is hard to offer exactly, since I embarked on a whole troubleshooting effort, but if that helps, I suspect the problem is with the node installation, but the installer does not overwrite previous versions of npm - somehow causing an internal problem. Troubleshooting Flow:

  • remove node
  • delete the nodejs folder located by default in ~ \ Program Files \ (lost node_modules with the npm folder found here)
  • reinstall node
  • globally remove / reinstall gulp

More information about the problem can be found here: npm 3 is broken when installing from the official OS X Node.js installer # 10434 , Although this is typical for OSX, I found that the situation is identical to me on the Windows side.

+11
source share

I had the same problem. I allowed him

  • Delete node_modules folder
  • npm install
+3
source share

All Articles