NPM run eslint 报错

vagrant@homestead:~/Code/larabbs-weapp$ npm run eslint

> larabbs-weapp@0.0.2 eslint /home/vagrant/Code/larabbs-weapp
> eslint --fix --ext .js,.wpy src

sh: 1: eslint: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! larabbs-weapp@0.0.2 eslint: `eslint --fix --ext .js,.wpy src`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the larabbs-weapp@0.0.2 eslint script.
npm ERR! This is probably not a problem with npm. There is likely additional log                                                             ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-12-12T23_28_11_853Z-debug.log

请问怎么解决?谢谢

api
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 4
liyu001989

build 的时候会进行 eslint 的检查,貌似不用单独运行

5年前 评论

@liyu001989
但是 控制台 Console 报错


WePY开启错误监控
VM1368:1 CLI报错:
/home/vagrant/Code/larabbs-weapp/src/app.wpy
23:1 error Expected indentation of 2 spaces but found 0 indent
24:5 error Expected indentation of 2 spaces but found 4 indent
28:5 error Expected indentation of 2 spaces but found 4 indent
34:5 error Expected indentation of 2 spaces but found 4 indent
43:3 error Expected indentation of 0 spaces but found 2 indent

✖ 5 problems (5 errors, 0 warnings)

5年前 评论
liyu001989

那你 build 的时候也能看到这个错啊,对应着改呗

5年前 评论

@Golang 原因应该是 yarn 安装 eslint 时没有全局安装,要在 ./node_modules/eslint/bin/eslint.js 中运行。
pakeage.json 中修改为 "eslint": "./node_modules/eslint/bin/eslint.js --fix --ext .js,.wpy src/"

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!