Ant-design-pro: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean.

Created on 23 Aug 2018  ·  55Comments  ·  Source: ant-design/ant-design-pro

当npm start的时候不能启动完成后会自动打开浏览器访问,后来报错的是The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean.
怎么解决报错信息呢?

Most helpful comment

遇到问题的朋友可以试下 [email protected]

All 55 comments

目测是babel的问题
cnpm试一试

@chenshuai2144 第一种是使用cnpm命令行工具有报错了,但是第二种方式直接 clone git 仓库正常打开访问的,没有报错的。

我也遇到这种情况了,怎么解决?

我的情况和你一模一样呢

怎么解决

如果是测试,把项目删掉,重新Pro new新建项目,然后把项目中的node_modules文件删除,然后npm install PS:不要用cnpm

@dead-horse 看看?tnpm 和 cnpm 都有问题,npm 是好的,pro 的 master 下载下来 install 和 start 就能重现。

应该又是某个 babel 依赖模块不统一的问题,@sorrycc 看看能不能固定一下。

同上, 一样的问题.
cnpm tnpm 都有报错

尝试使用npm安装,安装成功。但请求接口时,proxy失败:
image
@afc163

同报这个错误,tnpm 报错,删掉node_modules用npm重装之后ok

修改 package.json 即可,作为暂时的方案:

cnpm:

{
  "cnpm": {
    "mode": "npm"
  }
}

tnpm:

{
  "tnpm": {
    "mode": "npm"
  }
}

依赖的模块要统一锁下版本

使用 cnpm/tnpm 的可以尝试删除 stylelint,stylelint 依赖了 @babel/core@rc,和 [email protected] 依赖的 @babel/core@beta 在 cnpm/tnpm 下提升依赖时有冲突。

@ql434 [email protected] 依赖的 @babel 是锁了版本的。

我也是这个问题,有解决办法了吗

我们的环境目前只能用cnpm,这个问题可以解决吗?

我这里使用 npm install 也出现这个问题了

同问,已尝试删除stylelint相关,安装依赖之后还是不能启动。请问有没有临时解决的方案呢?

我使用npm解决了问题

@zinkey 的回复。

伴随着babel的升级,感觉带来不少问题,一不做二休,2.0发正式版吧

以前的项目重新install就出现这种问题,改成npm install后,能正常启动,但是代理似乎出问题,所有请求接口都出现超时400现象。

@sorrycc npm install成功后的代理问题,有临时解决方案吗?

@ybning 重新npm install后,在.webpackrc.js中配置proxy才能生效,原先在.roadhogrc.mock.js中的配置方法失效。
.webpackrc.js:新增代理:
proxy: {
"/lesson": {
"target": "http://localhost:8080/teach",
"changeOrigin": true,
"pathRewrite": {"^/lesson": ""}
},
},

.roadhogrc.mock.js中以前的写法:
const noProxy = true;
const apiurl="http://localhost:8080";
export default (noProxy ? {
'GET /lesson/(.)': apiurl+'/teach/',
'POST /lesson/(.
)': apiurl+'/teach/',
} : delay(proxy, 1000));

api.js:
export async function fakeAccountLogin(params) {
return request('/lesson/manage/login', {
method: 'POST',
body: params,
});
}
具体原因还未知。

可以吧package中研发的相关依赖包锁定版本,cnpm下可以正常使用。
{
"name": "ant-design-pro",
"version": "1.4.4",
"description": "An out-of-box UI solution for enterprise applications",
"private": true,
"scripts": {
"precommit": "npm run lint-staged",
"start": "cross-env ESLINT=none roadhog dev",
"start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev",
"build": "cross-env ESLINT=none roadhog build",
"site": "roadhog-api-doc static && gh-pages -d dist",
"analyze": "cross-env ANALYZE=true roadhog build",
"lint:style": "stylelint \"src//.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style",
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js",
"test": "roadhog test",
"test:component": "roadhog test ./src/components",
"test:all": "node ./tests/run-tests.js",
"prettier": "prettier --write ./src/
///"
},
"dependencies": {
"@antv/data-set": "^0.9.0",
"@babel/polyfill": "^7.0.0-beta.36",
"antd": "^3.8.0",
"bizcharts": "^3.1.10",
"bizcharts-plugin-slider": "^2.0.1",
"classnames": "^2.2.5",
"dva": "^2.2.3",
"dva-loading": "^2.0.3",
"enquire-js": "^0.2.1",
"lodash": "^4.17.10",
"lodash-decorators": "^6.0.0",
"moment": "^2.19.3",
"numeral": "^2.0.6",
"omit.js": "^1.0.0",
"path-to-regexp": "^2.1.0",
"prop-types": "^15.5.10",
"qs": "^6.5.0",
"react": "^16.4.1",
"react-container-query": "^0.11.0",
"react-document-title": "^2.0.3",
"react-dom": "^16.4.1",
"react-fittext": "^1.0.0",
"react-loadable": "^5.5.0",
"rollbar": "^2.3.4",
"setprototypeof": "^1.1.0",
"url-polyfill": "^1.0.10"
},
"devDependencies": {
"babel-eslint": "8.1.2",
"babel-plugin-dva-hmr": "0.4.1",
"babel-plugin-import": "1.6.7",
"babel-plugin-module-resolver": "3.1.1",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"cross-env": "5.1.1",
"cross-port-killer": "1.0.1",
"enzyme": "3.4.1",
"eslint": "5.0.0",
"eslint-config-airbnb": "17.0.0",
"eslint-config-prettier": "2.9.0",
"eslint-plugin-babel": "5.1.0",
"eslint-plugin-compat": "2.1.0",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-markdown": "1.0.0-beta.6",
"eslint-plugin-react": "7.0.1",
"gh-pages": "1.0.0",
"lint-staged": "7.2.0",
"mockjs": "^1.0.1-beta3",
"prettier": "1.14.2",
"pro-download": "1.0.1",
"redbox-react": "1.5.0",
"redux-logger": "3.0.6",
"regenerator-runtime": "0.12.0",
"roadhog": "^2.4.2",
"roadhog-api-doc": "^1.1.2",
"stylelint": "9.2.1",
"stylelint-config-prettier": "4.0.0",
"stylelint-config-standard": "18.0.0"
},
"optionalDependencies": {
"puppeteer": "^1.4.0"
},
"lint-staged": {
"/.{js,jsx,less}": [
"prettier --write",
"git add"
],
"
/.{js,jsx}": "npm run lint-staged:js",
"*/.less": "stylelint --syntax less"
},
"engines": {
"node": ">=8.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
]
}

检查package.json中是否存在一下依赖
"stylelint"
"stylelint-config-prettier"
"stylelint-config-standard"
删除后试试

@lxy224 还是你说的对 感谢

@lxy224 删除这个没什么影响嘛?

我删除了node_modules,采用 npm i 安装之后就好了

我也遇到这样的问题了
删除了node_models 再重新安装也不好使

npm i 的时候就已经报错了
image

然后运行cnpm i ok

然后运行npm start 报错
image

怎么回事儿呢

已解决:
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install

尝试了将cnpm换回npm 报新的错误

/var/jenkins_home/workspace/bi-web/node_modules/webpack/lib/Chunk.js:829
        throw new Error("Chunk.entrypoints: Use Chunks.addGroup instead");

没有使用stylelint只有用eslint,而且只在devDep里

proxy: {
"/api": {
"target": "http://127.0.0.1:2001",
"changeOrigin": true,
"pathRewrite": {"^/api": ""}
},
},
在.webpackrc.js配置完代理依旧不能使用

删除models之后用npm

遇到问题的朋友可以试下 [email protected]

@sorrycc 解决了,谢谢

我的也出现同样的问题,请问是怎么解决的

@sorrycc 谢谢 安装 [email protected] 后解决了

@sorrycc 安装[email protected]完美解决,赞一个,多谢~

唉,Basement 构建失败,原来这里这么多人遇到。。。

@sorrycc perfect

@sorrycc @kateli EWWhen I check out the antd project and npm install, it shows:
default
I've installed [email protected] but it still failed@sorry
I've tried the steps,but it doesn't work@kateli

@m26597 先更新npm再试试
npm i -g npm

然后
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install

I have tried this way. It doesn't work

| |
mengxj
|
|
邮箱:[email protected]
|

Signature is customized by Netease Mail Master

On 09/26/2018 18:04, kateli wrote:

@m26597 先更新npm再试试
npm i -g npm

然后
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

I am confused

| |
mengxj
|
|
邮箱:[email protected]
|

Signature is customized by Netease Mail Master

On 09/26/2018 18:25, m26597 wrote:
I have tried this way. It doesn't work

| |
mengxj
|
|
邮箱:[email protected]
|

Signature is customized by Netease Mail Master

On 09/26/2018 18:04, kateli wrote:

@m26597 先更新npm再试试
npm i -g npm

然后
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

这个问题貌似还没有比较好的解决方案,请大神出来解决一下

qq 20181007130226
注意红色的字 这个transform是专门给babel6的
7就安装下面的

{ "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], ] }
这么写
npm install
就好了
还是要详细的看文档

遇到问题的朋友可以试下 [email protected],亲自试了下可以解决这个问题。

[email protected] works for me.

已解决:
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install

已解决:使用 cnpm 出现, 删除 node_modules 所有文件再使用 npm 重新安装依赖。

我也出现了这个问题,我用官方的脚手架生成的packa.json文件里面有@babel/core和babel-core都有,只需要把babel-core卸载就可以了,用npm un babel-core

新入职公司,是用 pro 魔改的项目,里面还用什么 antd-bsc,升级以后也是报这个错误,采用上面@kateli的方法,删除了npm cache 以后,用 npm 安装就好了~

@sorrycc
👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaoding picture kaoding  ·  3Comments

yadongxie150 picture yadongxie150  ·  3Comments

cheung1111 picture cheung1111  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

lvzheng0404 picture lvzheng0404  ·  3Comments