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
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 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年前 评论

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