javascript - Express.js + lint 报错

标签 javascript node.js express vue.js eslint

https://www.youtube.com/watch?v=Fa4cRMaTDUI 我正在看这节课,并试图重现作者所做的一切。 19:00,他设置了 vue.js-express.js 项目。他创建了名为“服务器”的文件夹。在“server/”中,他运行“npm init -f”。然后'npm install --save nodemon eslint',然后他初始化eslint。 然后在 package.json 文件中他写道:

"scripts": {
    "start": "nodemon src/app.js --exec 'npm run lint && node'",
    "lint": "eslint **/*.js"
}

然后在“server”文件夹中,他创建了“src”文件夹。在“src”中,他创建了“app.js”。在'app.js;有一个简单的 console.log('hello')。 然后他运行“npm start”。 'Hello' 打印在终端中,nodemon 和 eslint 工作正常。然后他输入“npm install --save express”。那就是我的问题开始的地方。安装 express.js 后,我输入“npm start”,我在终端中收到此错误:

Oops! Something went wrong! :(

ESLint: 5.0.0.
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/r/.npm/_logs/2018-06-25T10_32_02_027Z-debug.log
[nodemon] process failed, unhandled exit code (2)
[nodemon] Error
at Bus.utils.bus.on (/home/r/projects/tab-tracker/server/node_modules    /nodemon/lib/nodemon.js:148:25)
    at Bus.emit (events.js:164:20)
at ChildProcess.<anonymous> (/home/r/projects/tab-tracker/server/node_modules/nodemon/lib/monitor/run.js:164:11)
at ChildProcess.emit (events.js:159:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)

为什么会这样?

最佳答案

引用模式,它和以前版本的 eslint 一样工作正常

"lint": "eslint \"**/*.js\""

功劳归功于 https://github.com/eslint/eslint/issues/10599

关于javascript - Express.js + lint 报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51021751/

相关文章:

javascript - Express 导出类中的箭头函数 - 意外的标记

javascript - Redux 状态树是否应该代表数据在 UI 中的组织方式?

javascript - 使用 [ selector ] 属性时获取 jquery on function 的更改元素?

javascript - 在 "input"事件上检测退格键和删除键?

javascript - 带对象的环回模型

node.js - 我在获取记录时遇到以下错误

javascript:声明并立即调用内联函数的原因

javascript - 从 Node.js 将参数传递给 Webpack

javascript - WaitForTarget 上的 Puppeteer 超时

node.js - 为什么在 Node.js 代码中使用 import 和 require()?