Create-react-app: Failed to minify the code from this file

Created on 6 Nov 2018  Â·  7Comments  Â·  Source: facebook/create-react-app

When i use npm run build the following is recurred but when i use npm start the build is working fine.

Failed to minify the code from this file:

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

the code at that line number is:

let fn = descriptor.value;
.

help me to solve this error issue.

thank you

low (ignored issue template) stale

Most helpful comment

@gowdruNikhil I got the same issue. I use [email protected] which has autobind-decorator "^2.1.0" as dependency, but the autobind-decorator author published the versions 2.2.0 and 2.2.1 four days ago. So now in my case npm install or yarn install with no lock file installs [email protected].
I can't tell why this [email protected] cannot be minified (and if it's the same for the 2.2.0). I use Yarn so I just changed the autobind-decorator "^2.1.0" dependecy of [email protected] for autobind-decorator "2.1.0" in my yarn.lock and the build is back to normal.

edit: from the autobinddecorators authors https://github.com/andreypopp/autobind-decorator#note-uglify-users

All 7 comments

We'll need a reproducing demo please.

@gowdruNikhil I got the same issue. I use [email protected] which has autobind-decorator "^2.1.0" as dependency, but the autobind-decorator author published the versions 2.2.0 and 2.2.1 four days ago. So now in my case npm install or yarn install with no lock file installs [email protected].
I can't tell why this [email protected] cannot be minified (and if it's the same for the 2.2.0). I use Yarn so I just changed the autobind-decorator "^2.1.0" dependecy of [email protected] for autobind-decorator "2.1.0" in my yarn.lock and the build is back to normal.

edit: from the autobinddecorators authors https://github.com/andreypopp/autobind-decorator#note-uglify-users

I have the same error when run 'yarn build'. I've tried what @khelkun suggested but it doesn't work for me. I've also tried to edit autobind-decorator to 2.1.1 but it also doesn't work.

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

> [email protected] 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: http://bit.ly/2tRViJ9

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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.

Here's my 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"
  },

My build.js and start-client.js inside ./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);

@nguyendviet
Do you have a yarn.lock file in your create-react-app project?
Do you yarn install --pure-lockfile?
Anyway please check your autobind-decorator version with the following command:
cat node_modules/autobind-decorator/package.json | grep version
By the way I don't see a 2.1 1 autobind-decorator version on npm, there's only a 2.1.0

Thank you @khelkun . The issue is actually not related to create-react-app, it was autobind-decorator.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fson picture fson  Â·  3Comments

rdamian3 picture rdamian3  Â·  3Comments

JimmyLv picture JimmyLv  Â·  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  Â·  3Comments

stopachka picture stopachka  Â·  3Comments