Enr*_*dez 5 javascript node.js npm express eslint
我正在按照本教程创建一个项目:使用 Vue.js 和 Express.js 的全栈 Web 应用程序:第 1 部分 - 介绍
我运行了下一个命令:“npm start”,它在我的 package.json 中配置如下:
"scripts": {
"start": "./node_modules/nodemon/bin/nodemon.js src/app.js --exec 'npm run lint && node'",
"lint": "./node_modules/.bin/eslint **/*.js"
},
Run Code Online (Sandbox Code Playgroud)
但是 ESLint 抛出了下一个错误:
Oops! Something went wrong! :(
ESLint: 5.0.1. No files matching the pattern "node_modules/ipaddr.js" were found. Please check for typing mistakes in the pattern.
npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! server@1.0.0 lint: `eslint **/*.js` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the server@1.0.0 lint script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /home/ironman/.npm/_logs/2018-06-26T13_45_13_295Z-debug.log [nodemon] process failed, unhandled exit code (2) [nodemon] Error
at Bus.utils.bus.on (/home/ironman/Documentos/Sandbox/Vuexpress/server/node_modules/nodemon/lib/nodemon.js:148:25)
at Bus.emit (events.js:187:15)
at ChildProcess.<anonymous> (/home/ironman/Documentos/Sandbox/Vuexpress/server/node_modules/nodemon/lib/monitor/run.js:164:11)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
Run Code Online (Sandbox Code Playgroud)
我知道昨天有人问了另一个话题,但除非我有 50 名声望,否则我无法对此发表评论。另外,joknawe指出,也许 eslint 正在尝试 lint 我的 node_modules 目录,但我不知道如何忽略它。
有没有办法解决这个问题?
以下工作:
// Pass on both Windows & Ubuntu.
// Note the slash & double quotes
// File: package.json:
"scripts": {
"lint": "eslint \"./**/*.js\"",
}
Run Code Online (Sandbox Code Playgroud)
以下在其中一个操作系统上不起作用:
// Windows - Fail - "Oops! Something went wrong! :("
// Note the single quotes
"lint": "eslint './**/*.js'",
// Ubuntu - Fail
// Note no quotes
"lint": "eslint ./**/*.js",
Run Code Online (Sandbox Code Playgroud)
希望有帮助。
我通过改变解决了完全相同的问题
“lint”:“./node_modules/.bin/eslint **/*.js”
到
“lint”:“./node_modules/.bin/eslint src/*.js”
希望这有帮助。
| 归档时间: |
|
| 查看次数: |
3320 次 |
| 最近记录: |