admin管理员组文章数量:1134064
So I've got a fresh install of El Capitan and I'm giving these task runners another go.
I'm following sitepoint's An introduction to Gulp.js, but I'm stuck on step four, when I try to run gulp jshint
I get "Error: Cannot find module 'jshint/src/cli'
"
I've no idea what's causing this, which is why I'm asking here. Below are a couple of screen grabs to help with the issue.
As always, I'm eternally grateful for any advice.
So I've got a fresh install of El Capitan and I'm giving these task runners another go.
I'm following sitepoint's An introduction to Gulp.js, but I'm stuck on step four, when I try to run gulp jshint
I get "Error: Cannot find module 'jshint/src/cli'
"
I've no idea what's causing this, which is why I'm asking here. Below are a couple of screen grabs to help with the issue.
As always, I'm eternally grateful for any advice.
Share Improve this question asked Nov 29, 2015 at 15:38 lateralauslateralaus 1,5333 gold badges11 silver badges11 bronze badges 7 | Show 2 more comments6 Answers
Reset to default 328You need to install jshint as well, that will sort out the issue.
> npm install --save-dev jshint gulp-jshint
It turns out I need to use npm install --save-dev jshint gulp-jshint
instead of npm install gulp-jshint --save-dev
as the tutorial stated. Discussion around this was found at https://github.com/spalger/gulp-jshint/issues/131 with massive thanks to @user3042437 for suppling the link.
If you still get the error after you put in the correct syntax above, (npm install --save-dev jshint gulp-jshint), which works.
Before you run the install again, go into your package.json file and remove the lines for jshint and gulp-jshint before you run the install, make sure you edit you package.json to remove the lines that call jshint and gulp-jshint, otherwise, the error will persist.
Sometimes the order of the phrasing does matter. I found out that this
npm install --save-dev jshint gulp-jshint
does not work but this npm install jshint gulp-jshint --save
works
Here you target jshint
, which you probably didn't install. (You do this in gulp.task('jshint', function() {
.)
Try this:
gulp.task('gulp-jshint', function() {
This matches the way you require
d it.
var jshint = require('gulp-jshint');
There is a temporary solution for bypassing this error. Even this temporary solution will also work properly, if in case you don't want to use jshint.js file in you application anywhere.
- Go to your gulpfile.js file.
Comment the code in line number 4.
var jshint = require('gulp-jshint');
Now, run gulp command in your terminal. Your server will be up.
本文标签: javascriptGulp Error Cannot find module 39jshintsrccli39Stack Overflow
版权声明:本文标题:javascript - Gulp Error: Cannot find module 'jshintsrccli' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736795225a1953261.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
npm install jshint gulp-jshint --save-dev
from the root of your node app. – MinusFour Commented Nov 29, 2015 at 16:03npm install jshint
? – Flobin Commented Nov 30, 2015 at 20:52npm install gulp-jshint --save-dev
is that different tonpm install jshint
? – lateralaus Commented Dec 5, 2015 at 16:37