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

[BUG] UNABLE_TO_GET_ISSUER_CERT_LOCALLY #510

Closed
jpswade opened this issue Nov 22, 2019 · 4 comments
Closed

[BUG] UNABLE_TO_GET_ISSUER_CERT_LOCALLY #510

jpswade opened this issue Nov 22, 2019 · 4 comments

Comments

@jpswade
Copy link

jpswade commented Nov 22, 2019

What / Why

Trying to run npm install on an AWS EC2 Amazon Linux instance, it fails.

When

  • Whenever I run npm install on an AWS EC2 Amazon Linux instance.

Where

  • On an AWS EC2 Amazon Linux instance

How

Current Behavior

  • npm install fails
[ec2-user@ip-172-31-34-238 ondeck]$ sudo npm install
npm http GET https://registry.npmjs.org/sass-loader
npm http GET https://registry.npmjs.org/sass-loader
npm http GET https://registry.npmjs.org/sass-loader
npm ERR! Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR!     at SecurePair.<anonymous> (tls.js:1430:32)
npm ERR!     at SecurePair.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:1029:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:521:13)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:341:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:418:25)
npm ERR!     at doWrite (_stream_writable.js:226:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:216:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR!     at write (_stream_readable.js:602:24)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.14.146-93.123.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/app/ondeck
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/app/ondeck/npm-debug.log
npm ERR! not ok code 0

Steps to Reproduce

  • npm install

Expected Behavior

  • It should install

Who

  • Me
  • Anyone

References

@jpswade
Copy link
Author

jpswade commented Nov 22, 2019

After a bit more hunting, I found this:

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

This error means that there's a TLS certificate in the chain that is signed by
an unknown certificate authority (CA). Presumably, this is the certificate used
by one's HTTPS proxy. The solution is to configure the
cafile value:

$ npm config set cafile /path/to/your/file.pem

If you need to, you can generate a .pem file from a .crt one with:

$ openssl x509 -inform der -in /path/to/the.crt -out /path/to/the/file.pem

For more discussion on this error, see
#9580 and
nodejs/node#3742.

From: https://raw.githubusercontent.com/wiki/npm/npm/Troubleshooting.md

I'm going to try this.

@jpswade
Copy link
Author

jpswade commented Nov 22, 2019

[ec2-user@ip-xxx current]$ npm config set cafile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem 
[ec2-user@ip-xxx current]$ npm install && npm run prod
npm http GET https://registry.npmjs.org/axios
npm http GET https://registry.npmjs.org/bootstrap
npm http GET https://registry.npmjs.org/vue-template-compiler
npm http GET https://registry.npmjs.org/cross-env
npm http GET https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/laravel-mix
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/popper.js
npm http GET https://registry.npmjs.org/resolve-url-loader
npm http GET https://registry.npmjs.org/sass
npm http GET https://registry.npmjs.org/sass-loader
npm http GET https://registry.npmjs.org/vue
npm http GET https://registry.npmjs.org/vue-template-compiler
npm http GET https://registry.npmjs.org/axios
npm http GET https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/bootstrap
npm http GET https://registry.npmjs.org/cross-env
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/popper.js
npm http GET https://registry.npmjs.org/resolve-url-loader
npm http GET https://registry.npmjs.org/laravel-mix
npm http GET https://registry.npmjs.org/sass
npm http GET https://registry.npmjs.org/vue
npm http GET https://registry.npmjs.org/sass-loader
npm http GET https://registry.npmjs.org/vue-template-compiler
npm http GET https://registry.npmjs.org/bootstrap
npm http GET https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/cross-env
npm http GET https://registry.npmjs.org/axios
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/sass
npm http GET https://registry.npmjs.org/popper.js
npm http GET https://registry.npmjs.org/laravel-mix
npm http GET https://registry.npmjs.org/resolve-url-loader
npm http GET https://registry.npmjs.org/vue
npm http GET https://registry.npmjs.org/sass-loader
npm ERR! Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR!     at SecurePair.<anonymous> (tls.js:1430:32)
npm ERR!     at SecurePair.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:1029:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:521:13)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:341:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:418:25)
npm ERR!     at doWrite (_stream_writable.js:226:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:216:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR!     at write (_stream_readable.js:602:24)
npm ERR!     at flow (_stream_readable.js:611:7)
npm ERR!     at Socket.pipeOnReadable (_stream_readable.js:643:5)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.14.146-93.123.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/app/current
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 4.14.146-93.123.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/app/current
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/app/current/npm-debug.log
npm ERR! not ok code 0

@jpswade
Copy link
Author

jpswade commented Nov 22, 2019

It occurs to me that I'm using node v0.x which probably explains the problem.

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

1 participant