[英]error Command failed with exit code 1. with react-native and yarn eslint
When I run yarn run lint fileName
, it returns当我运行
yarn run lint fileName
时,它返回
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
What I've tried are yarn install
and yarn upgrade
.我尝试过的是
yarn install
和yarn upgrade
。 npm install
is also done. npm install
也完成了。 Oddly, ESLint itself is working so it can edit my file in spite of this error.奇怪的是,ESLint 本身正在工作,因此尽管出现此错误,它仍可以编辑我的文件。 However, I would like to solve this error.
但是,我想解决这个错误。
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint --ext .ts,.tsx,.js,.jsx"
},
"dependencies": {
"@expo/react-native-action-sheet": "^3.8.0",
"@freakycoder/react-native-header-view": "^0.5.1",
"@react-native-firebase/app": "^7.3.0",
"@react-navigation/native": "^5.5.1",
"base-64": "^0.1.0",
"eslint-cli": "^1.1.1",
"expo": "^37.0.12",
"expo-facebook": "~8.1.0",
"expo-font": "~8.1.0",
"expo-google-sign-in": "~8.1.0",
"expo-image-picker": "~8.1.0",
"google-auth-library": "^6.0.2",
"native-base": "^2.13.12",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-actionsheet": "^2.4.2",
"react-native-elements": "^2.0.2",
"react-native-gesture-handler": "~1.6.0",
"react-native-image-picker": "^2.3.1",
"react-native-modal": "^11.5.6",
"react-native-tableview-simple": "^3.2.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.9",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.10.3",
"babel-eslint": "^10.1.0",
"babel-preset-expo": "^8.2.3",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"prettier": "2.0.5",
"react-native-dotenv": "^0.2.0"
}
}
This is my package.json.这是我的 package.json。 I am not sure what is the problem.
我不确定是什么问题。 I would appreciate any suggestions.
我将不胜感激任何建议。
This is by design from eslint and both NPM and Yarn return the error as an exit code.这是 eslint 设计的,NPM 和 Yarn 都将错误作为退出代码返回。
You can silence the exit code in both by adding the --silent
flag.您可以通过添加
--silent
标志来使两者中的退出代码静音。
npm run lint /file/path --silent
yarn run --silent lint /file/path
It could be that there is a lint finding that throws an error.可能是存在引发错误的 lint 发现。 ESLint does this if the rule is set to
error
and not warning
.如果规则设置为
error
而不是warning
,ESLint 就会这样做。 See discussion at https://github.com/eslint/eslint/issues/7933 for the issue in npm (yarn may have same problem)有关 npm 中的问题,请参阅https://github.com/eslint/eslint/issues/7933中的讨论(纱线可能有同样的问题)
The short version is that you have to either:简短的版本是您必须:
warning
instead of error
warning
而不是error
"lint": "eslint app/;exit 0"
)"lint": "eslint app/;exit 0"
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.