【发布时间】:2016-07-25 22:57:22
【问题描述】:
我一直在尝试使用 jshint grunt 模块来验证我的代码,但我总是收到以下错误:
Running "jshint" task
[D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js
Running "jshint:all" (jshint) task
[D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js
Verifying property jshint.all exists in config...OK
Files: Gruntfile.js, app/scripts/app.js
Options: force=false, reporterOutput=null, jshintrc=".jshintrc", reporter={}
Warning: Path must be a string. Received { toString: [Function], reporter: [Function] } Use --force to continue.
问题是,即使使用 --verbose 和 -debug,它也没有显示任何可以解决错误的方法,只是“路径必须是字符串”,我使用 JSLint(使用方括号)验证了文件并且它工作得很好好吧,网站也可以正常工作。
到目前为止我做了什么。
- 未安装 node.js 和 node 模块 3 次(每次都尝试不同的东西)。
- 试图将我的 grunt 任务限制为简单地验证一个非常简单的 js 文件,但也不起作用,这意味着这与代码或我的 gruntfile.js 无关。
【问题讨论】:
-
Gulp 似乎是构建解决方案的更好选择,它比 Grunt 更容易、更快捷;
-
你运行的是什么版本的节点?我刚刚更新到 6,我收到了这个错误。
标签: node.js npm gruntjs jshint