解决:transform-decorators-legacy 报错

最近在运行一个React招聘网站移动端 | 技术栈 : React16+Antd+Router4+Redux+axios+Express+MongoDB |

项目地址:   https://github.com/TYRMars/React-Advertises

执行npm run start

报错

Failed to compile.

./src/index.js
Module build failed: ReferenceError: Unknown plugin "transform-decorators-legacy" specified in "C:\\Users\\72074530\\Desktop\\1234\\app\\package.json" at 1, attempted to resolve relative to "C:\\Users\\72074530\\Desktop\\1234\\app"
at Array.map (<anonymous>)

 

执行如下指令解决

npm install babel-plugin-transform-class-properties babel-plugin-transform-decorators-legacy babel-plugin-transform-export-extensions babel-plugin-transform-object-rest-spread babel-preset-env --save-dev

其实这个项目还需要额外:

npm install react-router-dom --save-dev

 并且注释掉:

 

posted @ 2020-08-29 18:55  Fanyee  阅读(1603)  评论(0编辑  收藏  举报