我在Windows 7中全局安装了node.js应用程序和jshint。我正在尝试配置启动脚本,以便在加载任务时可以查看任何潜在的错误。
这是我的项目目录:
app
--routes.js
config
--config.js
--sequelize.js
--passport.js
views
--index.ejs
package.json
.gitignore
.jshintrc
从目录的顶层,当我运行jshint。,在所有子文件夹上递归执行错误检测时,我得到了预期的输出。但是,当我尝试在package.json中建立一个脚本时,如下所示:
"scripts": {
"start": "npm run nodemon ./app.js",
"lint": "jshint .",
"nodemon": "nodemon"
},
"devDependencies": {
"jshint": "^2.9.2"
}
我确认“lint”脚本是这样注册的:
npm run
Lifecycle scripts included in chinese-democracy:
start
npm run nodemon ./app.js
available via `npm run-script`:
lint
jshint .
nodemon
nodemon
然后尝试
npm run lint
我使用以下信息获得与以前相同的错误输出:
这是我完整的package.json文件供参考:
{
"name": "chinese-democracy",
"dependencies": {
"body-parser": "^1.15.2",
"config": "^1.21.0",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.3",
"crypto": "0.0.3",
"ejs": "^2.4.2",
"express": "4.14.0",
"express-session": "^1.14.0",
"lodash": "^4.13.1",
"mysql": "^2.11.1",
"nodemon": "^1.10.0",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"sequelize": "^3.23.4"
},
"scripts": {
"start": "npm run nodemon ./app.js",
"lint": "jshint .",
"nodemon": "nodemon"
},
"devDependencies": {
"jshint": "^2.9.2"
}
}
实质上,为什么jshint输出会生成,但是出现了错误消息,说它失败了?