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
请问怎么解决?谢谢
关于 LearnKu
build 的时候会进行 eslint 的检查,貌似不用单独运行
@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)
那你 build 的时候也能看到这个错啊,对应着改呗
@Golang 原因应该是
yarn安装eslint时没有全局安装,要在./node_modules/eslint/bin/eslint.js中运行。在
pakeage.json中修改为"eslint": "./node_modules/eslint/bin/eslint.js --fix --ext .js,.wpy src/"