版本号
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
7条答案
按热度按时间kg7wmglp1#
源码中将componentWillReceiveProps替换成UNSAFE_componentWillReceiveProps即可,是因为react新版本中方法名改了
esyap4oy2#
我也遇到了,是 eslint 新版本的问题。把eslint 相关配置关了就好了
xmd2e60i3#
安装yapi-plugin-gitlab插件的时候遇到了这个问题,请问有人安装yapi-plugin-gitlab成功了吗?
cyj0122/yapi-plugin-gitlab#16
fruv7luv4#
将 "eslint-plugin-react" 版本 锁死在 7.1.0 可以解决这个问题
yws3nbqq5#
您这样操作后,解决了吗?
o2rvlv0m6#
@yuqingc
你好,如何管理eslint的配置?
q43xntqr7#
@wwb568109135 你先试一下楼上说的
如果不行,参考我的配置