javascript - Express.js + lint 出错
问题描述
https://www.youtube.com/watch?v=Fa4cRMaTDUI 我正在观看本课并尝试重新创建作者所做的一切。19:00 他设置了 vue.js-express.js 项目。他创建了名为“服务器”的文件夹。在“服务器/”中,他运行“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"
}
然后在文件夹“服务器”中创建文件夹“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\""
推荐阅读
- django - 将 django_admin 的 list_display 覆盖为 cascadingdropdown 样式
- android - Xamarin.Android:以编程方式更改 ProgessDialog 背景颜色
- javascript - 使用 vue.js 和 bootstrap 显示所有数组
- c# - Gmap库c#中的地球边框
- c++ - C++ 从模板参数创建元组向量
- c# - c# 类库的配置
- oracle - 在过程中未选择任何行时显示自定义消息
- vb.net - 互斥锁不锁定和使用不释放文件句柄
- vb.net - 将 Excel 文件数据导出到数据表
- c# - 从托盘恢复应用程序