测试您使用cmd运行的版本
babel -V
如果不是版本7或更高版本
npm uninstall babel-cli -g
npm uninstall babel-core -g
和
npm install @babel/cli -g
npm install @babel/core -g
我在网上发现的所有解决方案均无效,我通过以下方式对其进行了修复:
- 删除
jest
并@babel/core
从的package.json(保持babel-core
V7桥) - 删除node_modules和package-lock.json
- npm安装
- npm install jest @ babel / core --save-dev