Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install return 1 after postinstall core-js #673

Closed
YIREN1 opened this issue Oct 20, 2019 · 15 comments
Closed

npm install return 1 after postinstall core-js #673

YIREN1 opened this issue Oct 20, 2019 · 15 comments

Comments

@YIREN1
Copy link

YIREN1 commented Oct 20, 2019

`

root@aaa3cc671bd8:/app# npm i
core-js@3.1.4 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...

@zloirock
Copy link
Owner

I have no ideas.

@te-online
Copy link

te-online commented Nov 4, 2019

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

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

@te-online
Copy link

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.

@YIREN1
Copy link
Author

YIREN1 commented Nov 5, 2019

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

@te-online
Copy link

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

@zloirock
Copy link
Owner

Could you check it with the current version?

@zloirock
Copy link
Owner

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

@te-online
Copy link

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.

@luigimannoni
Copy link

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

@arirah
Copy link

arirah commented May 8, 2020

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

@avtaniket
Copy link

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

@luigimannoni
Copy link

luigimannoni commented Jul 18, 2020

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

@avtaniket
Copy link

DISABLE_OPENCOLLECTIVE

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

@luigimannoni
Copy link

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

@fangbinwei
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants