当我成功地运行( export PKG=eslint-config-airbnb; npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest" )时。eslint --init并在package.json中运行脚本。
信息:我的节点node v7.5.0 npm 4.1.2
下面有问题。
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/next/.nvm/versions/node/v7.5.0/bin/node"
/Users/next/.nvm/versions/node/v7.5.0/bin/npm" "run" "lint"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! beslint@1.0.0 lint: `eslint app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beslint@1.0.0 lint script 'eslint app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the beslint package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs beslint
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls beslint
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/next/es6/jsmodules/beslint/npm-debug.log发布于 2017-02-26 19:09:54
您确定运行eslint --init有效吗?
这就像您没有.eslintrc文件一样( ESLint解析器选项和规则的配置文件)。在您的项目的根目录下检查/创建.eslintrc文件,您称之为"beslint“。
然后,您需要将其添加到.eslintrc文件中,以便ESLint考虑到您希望扩展Airbnb团队的规则:
{ "extends": "airbnb" }
请注意,您可以安装Airbnb团队的不同规则:
您的extends文件中的.eslintrc值应该与您的安装相匹配,并且是前面三个值之一。
我制作了一个小小的命令行工具,可以用这三种不同的Airbnb来安装ESLint。如果尚未完成,则自动创建和配置.eslintrc文件。它对我的个人项目和工作都有很大的帮助!它叫esbnb。希望它能帮到你。
https://stackoverflow.com/questions/42289259
复制相似问题