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. npm
is 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?
I struggled with this as well. Fix: https://gist.github.com/anonymous/fb32a4b053fe121b0b03. When applied in container_commands
npm install
has already run.
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
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.
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 ""'
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.