Gulp Error: cannot find module 'jshint / src / cli'

So, I have a new installation of El Capitan, and again I give these runners tasks.

I follow the sitepoint Introduction to Gulp.js , but I am stuck in the fourth step, when I try to run gulp jshint , I get " Error: Cannot find module 'jshint/src/cli' "

I do not know what causes this, so I ask here. Below are a few screenshots to help solve this problem.

Error starting gulp jshint

Structuring folders for gulp project

As always, I am infinitely grateful for any advice.

+86
javascript terminal jshint gulp
Nov 29 '15 at 15:38
source share
4 answers

You need to install jshint to solve the problem.

 > npm install --save-dev jshint gulp-jshint 
+248
Dec 01 '15 at 0:44
source share

Turns out I need to use npm install --save-dev jshint gulp-jshint instead of npm install gulp-jshint --save-dev as described in the tutorial. A discussion of this was found at https://github.com/spalger/gulp-jshint/issues/131 with many thanks to @ user3042437 for providing the link.

+24
Dec 13 '15 at 21:15
source share

Sometimes the order of phrasing matters. I found out that this npm install --save-dev jshint gulp-jshint does not work, but this npm install jshint gulp-jshint --save works

-one
May 04 '17 at 1:33 pm
source share

Here you are targeting jshint , which you probably haven't installed. (You do this in gulp.task('jshint', function() { .)

Try the following:

 gulp.task('gulp-jshint', function() { 

This is consistent with what you require d.

 var jshint = require('gulp-jshint'); 
-one
Jun 07 '17 at 21:37
source share



All Articles