-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yapi build提示出错: 28:5 error componentWillMount is deprecated since React 16.999.0, use UNSAFE_componentWillMount instead #824
Comments
源码中将componentWillReceiveProps替换成UNSAFE_componentWillReceiveProps即可,是因为react新版本中方法名改了 |
我也遇到了,是 eslint 新版本的问题。把eslint 相关配置关了就好了 |
安装yapi-plugin-gitlab插件的时候遇到了这个问题,请问有人安装yapi-plugin-gitlab成功了吗? |
将 "eslint-plugin-react" 版本 锁死在 7.1.0 可以解决这个问题 |
您这样操作后,解决了吗? |
@yuqingc |
@wwb568109135 你先试一下楼上说的
如果不行,参考我的配置 module.exports = {
env: {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
extends: ["eslint:recommended", "plugin:react/recommended"],
parser: "babel-eslint",
parserOptions: {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
plugins: [
"react",
"import"
],
rules: {
"indent": ["off", 2],
"react/display-name": ["off"],
"react/jsx-indent": ["error", 2],
"comma-dangle": ["off"],
"no-console": ["off"],
"import/no-unresolved": ["off"],
"react/no-find-dom-node": ["off"],
"react/no-danger-with-children": ["off"]
}
}; |
版本号
1.5.2
什么问题
在yapi目录下,执行 yapi build会提示:ykit: command not found
手工修改 /usr/local/lib/node_modules/yapi-cli/src/commands/build.js,添加:
shell.exec('npm install ykit --registry https://registry.npm.taobao.org');
再次执行 yapi build,会提示一堆error,例如:
[error] ./client/components/AuthenticatedComponent.js
/root/my-yapi/vendors/client/components/AuthenticatedComponent.js
28:5 error componentWillMount is deprecated since React 16.999.0, use UNSAFE_componentWillMount instead, see https://reactjs.org/docs/react-component.html#unsafe_componentwillmount. Use https://github.com/reactjs/react-codemod#rename-unsafe-lifecycles to automatically update your components react/no-deprecated
31:5 error componentWillReceiveProps is deprecated since React 16.999.0, use UNSAFE_componentWillReceiveProps instead, see https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops. Use https://github.com/reactjs/react-codemod#rename-unsafe-lifecycles to automatically update your components react/no-deprecated
✖ 2 problems (2 errors, 0 warnings)
[error] ./client/components/MyPopConfirm/MyPopConfirm.js
/root/my-yapi/vendors/client/components/MyPopConfirm/MyPopConfirm.js
29:3 error componentWillReceiveProps is deprecated since React 16.999.0, use UNSAFE_componentWillReceiveProps instead, see https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops. Use https://github.com/reactjs/react-codemod#rename-unsafe-lifecycles to automatically update your components react/no-deprecated
✖ 1 problem (1 error, 0 warnings)
如何复现此问题
1、全新Centos7系统,手工安装node11.0.0:
http://nodejs.org/dist/v11.0.0/node-v11.0.0.tar.gz
2、进入yapi安装目录,执行 yapi build 即可复现
什么浏览器
~
什么系统(Linux, Windows, macOS)
Centos7
The text was updated successfully, but these errors were encountered: