Core-js: npm install return 1 after postinstall core-js

Created on 20 Oct 2019  路  15Comments  路  Source: zloirock/core-js

`

root@aaa3cc671bd8:/app# npm i
[email protected] postinstall /app/node_modules/@angular-devkit/build-angular/node_modules/core-js
node scripts/postinstall || echo "ignore"
`
Screen Shot 2019-10-19 at 11 21 51 PM

npm install return 1 after postinstall core-js, in docker on Linux(cloud VM).
Screen Shot 2019-10-19 at 11 28 50 PM
Even if I do npm i -loglevel verbose, > node scripts/postinstall || echo "ignore" is the last thing I see from console.

I assume I should see some messages after that?

And this issue could cause docker image build to fail..

Does anyone run into this?
Thanks in advance!

EDIT: I also tried to upgrade core-js to the lastest version and it is still contantly happening...

Most helpful comment

I didn't run the command at build time, but in the started container. But even in the started container if I run npm install core-js it hangs.

After a little bit of playing around I restructured my codebase to not use core-js, but then the problem occurred with a different package. So I went to search for another solution.

What fixed this behavior for me was setting unsafe-perm to true. Maybe this is needed if you're running npm as root.

Before running npm install, make sure to run npm config set unsafe-perm true.
In a Dockerfile this would be RUN npm config set unsafe-perm true.

Note: If you're not running this in a container, but on your own system, make sure you understand what the config does, since it contains the word unsafe I'm assuming it might be not safe under certain circumstances 馃槃

See for reference: https://stackoverflow.com/a/52196681/5418064

All 15 comments

I have no ideas.

I run into the same problem here 馃 Will investigate a little more...

Edit: It's in a arm64v8/node:12.9-alpine container

The script runs fine if I just run node postinstall ||聽echo "ignore" in node_modules/core-js. So it's either the way npm invokes the command or the options it passes.

The script runs fine if I just run node postinstall || echo "ignore" in node_modules/core-js. So it's either the way npm invokes the command or the options it passes.

how did you run that command... did you run that insider the container or when the image is build or ...Since I do npm install in the layer when building the image

I didn't run the command at build time, but in the started container. But even in the started container if I run npm install core-js it hangs.

After a little bit of playing around I restructured my codebase to not use core-js, but then the problem occurred with a different package. So I went to search for another solution.

What fixed this behavior for me was setting unsafe-perm to true. Maybe this is needed if you're running npm as root.

Before running npm install, make sure to run npm config set unsafe-perm true.
In a Dockerfile this would be RUN npm config set unsafe-perm true.

Note: If you're not running this in a container, but on your own system, make sure you understand what the config does, since it contains the word unsafe I'm assuming it might be not safe under certain circumstances 馃槃

See for reference: https://stackoverflow.com/a/52196681/5418064

Could you check it with the current version?

Closed due to lack of response. Most likely, the current approach should not cause this issue.

Thanks for addressing it in a release! Same problem persist聽with the latest version, but it's still possible to overcome this, by using npm config set unsafe-perm true.

Problem still exists if a project with core-js is deployed on an AWS Elastic Beanstalk environment

I didn't run the command at build time, but in the started container. But even in the started container if I run npm install core-js it hangs.

After a little bit of playing around I restructured my codebase to not use core-js, but then the problem occurred with a different package. So I went to search for another solution.

What fixed this behavior for me was setting unsafe-perm to true. Maybe this is needed if you're running npm as root.

Before running npm install, make sure to run npm config set unsafe-perm true.
In a Dockerfile this would be RUN npm config set unsafe-perm true.

_Note:_ If you're not running this in a container, but on your own system, make sure you understand what the config does, since it contains the word unsafe I'm assuming it might be not safe under certain circumstances 馃槃

See for reference: https://stackoverflow.com/a/52196681/5418064

Works for me .. that means unsafe perm was false

Failed to build Docker image aws_beanstalk/staging-app: /node_modules/core-js > node -e "try{require('./postinstall')}catch(e){}" [91m [0mThe command '/bin/sh -c npm install' returned a non-zero code: 1.

AWS elastic beanstalk environment

@avtaniket I have eventually fixed the issue on AWS by adding DISABLE_OPENCOLLECTIVE=true as environment variable during build time.

DISABLE_OPENCOLLECTIVE

what exactly purpose of this variable, How does it fix this issue?

Comes from the opencollective package, seemingly used on core-js to display the donation messages on the postinstall script.

when my file path is too long, this error occur. My OS is win10.

Was this page helpful?
0 / 5 - 0 ratings