Express.js + lint给出了错误 [英] Express.js + lint gives mistake

查看:429
本文介绍了Express.js + lint给出了错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://www.youtube.com/watch?v=Fa4cRMaTDUI
我正在观看本课并尝试重新创作作者所做的一切。 19:00他设置了vue.js-express.js项目。他创建了名为server的文件夹。在'server /'中,他运行'npm init -f'。然后'npm install --save nodemon eslint',然后他就进入了eslint。
然后在package.json文件中他写道:

https://www.youtube.com/watch?v=Fa4cRMaTDUI I am watching this lesson and trying to recreate everything author does. At 19:00 he sets vue.js-express.js project. He creates folder called 'server'. In 'server/' he runs 'npm init -f'. Then 'npm install --save nodemon eslint', then he inits eslint. Then in package.json file he writes:

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

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

Then in folder 'server' he creates folder 'src'. In 'src' he creates 'app.js'. And in 'app.js; there is a simple console.log('hello'). Then he runs 'npm start'. 'Hello' is printed in terminal, nodemon and eslint works just fine. Then he types 'npm install --save express'. Thats where my problem begins. After installing express.js i type 'npm start' and i get this error in terminal:

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)

为什么会这样?

推荐答案

@joknawe在评论中给出了正确答案,谢谢。
编辑:

@joknawe in comments gave right answer, thanks. edit:


看起来好像是在尝试lint你的node_modules目录。默认情况下应忽略此项,但您的通配符** / * .js可能会导致此问题。尝试使用eslint

Looks like maybe it is trying to lint your node_modules directory. This should be ignored by default, but your wildcard **/*.js may be causing the issue. Try just using eslint

这篇关于Express.js + lint给出了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆