create-react-app错误无法缩小autobind-decorator中的代码

时间:2018-11-15 22:33:40

标签: node.js reactjs express create-react-app

运行yarn build时出现错误。我尝试了@khelkun建议的here,但对我而言不起作用。我也尝试将autobind-decorator修改为2.1.1,但它也无效。

$ yarn build
yarn run v1.12.3
$ node scripts/build.js

> myapp@0.1.0 build /path/myapp/client
> react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

    ./node_modules/autobind-decorator/src/index.js:7 

Read more here: // SOF doesn't let me paste the shortened link but it goes to: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the myapp@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /path/.npm/_logs/2018-11-15T22_23_20_735Z-debug.log
✨  Done in 11.02s.

这是我的package.json

"scripts": {
    "server": "node server.js",
    "client": "node scripts/start-client.js",
    "start": "concurrently \"nodemon server.js\" \"npm run client\"",
    "build": "node scripts/build.js"
  },

我在build.js内的start-client.js./scripts

// build.js
const args = ["run build"];
const opts = { stdio: "inherit", cwd: "client", shell: true };
require("child_process").spawn("npm", args, opts);

// start-client.js
const args = ["start"];
const opts = { stdio: "inherit", cwd: "client", shell: true };
require("child_process").spawn("npm", args, opts);

0 个答案:

没有答案