SELF_SIGNED_CERT_IN_CHAIN error on Elastic Beansta

2019-02-19 09:23发布

I'm well aware of the root of this issue, as npm wrote on their blog: http://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more

The solution is to either:

1) upgrade your version of npm

npm install npm -g

or

2) tell your current version of npm to use known registrars

npm config set ca ""

However, neither of these solution work on Elastic Beanstalk. npmis linked to the version of node installed (v0.10.10), and it is not possible to tell the current npm version to use known registrars.

I run a 64-bit Amazon Linux instance for NodeJS

Adding this command in .ebextensions does not help:

container_commands:
  01_npm-fix:
    command: /opt/elasticbeanstalk/node-install/node-v0.10.10-linux-x64/bin/npm config set ca ""

Anyone as figured out a solution for this?

5条回答
相关推荐>>
2楼-- · 2019-02-19 10:14

It did not work for me either.

What I did find: at the time that the "commands" block is run, the node-install folder is empty. I assume this is because the commands run before node + npm is fully deployed to the bare instance.

I will try and test this assumption later today, and provide further feedback.

查看更多
够拽才男人
3楼-- · 2019-02-19 10:15

I struggled with this as well. Fix: https://gist.github.com/anonymous/fb32a4b053fe121b0b03. When applied in container_commands npm install has already run.

查看更多
贼婆χ
4楼-- · 2019-02-19 10:17

So I figured out a way to make it work:

Put this in .ebextensions:

commands:
  01_enable_rootaccess:
    command: echo Defaults:root \!requiretty >> /etc/sudoers
  02_no-cert:
    command: sudo /opt/elasticbeanstalk/node-install/node-v0.10.10-linux-x64/bin/npm config set ca ""

Worked like a charm in my case.

查看更多
男人必须洒脱
5楼-- · 2019-02-19 10:25

Was having the same issue today. I fixed it by setting my global npmrc file, as follows:

02_no-cert:
  command: "rm -rf /opt/elasticbeanstalk/node-install/node-v0.10.21-linux-x64/etc && mkdir /opt/elasticbeanstalk/node-install/node-v0.10.21-linux-x64/etc && echo 'ca = ' > /opt/elasticbeanstalk/node-install/node-v0.10.21-linux-x64/etc/npmrc"
  ignoreErrors: true
查看更多
小情绪 Triste *
6楼-- · 2019-02-19 10:28

Sadly, didn't work for me. Amazon gave me a different version, that has not worked either:

commands: 01-command: command: '$(find /opt/elasticbeanstalk/node-install/*/bin | grep "npm$" | head -n1) config set ca ""'

查看更多
登录 后发表回答