ngrok icon indicating copy to clipboard operation
ngrok copied to clipboard

npm installation fails

Open bserem opened this issue 7 years ago • 32 comments

As of today I can't install ngrok via npm, I get the following output on Debian with node 5.0.4:

sudo npm install ngrok -g
/usr/local/bin/ngrok -> /usr/local/lib/node_modules/ngrok/bin/ngrok

> [email protected] postinstall /usr/local/lib/node_modules/ngrok
> node ./postinstall.js

ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ...
ngrok - error downloading binary. { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/ngrok/bin/ngrok.zip'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/usr/local/lib/node_modules/ngrok/bin/ngrok.zip' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-06-28T11_13_44_043Z-debug.log

Installation was working fine 10 days ago.

This also breaks the installation of https://github.com/expo/exp

bserem avatar Jun 28 '17 11:06 bserem

@bserem Same here, I used this installation method on my last machine a few months ago, but after reinstalling it yesterday it doesn't work anymore. I get the same error message.

shroudedcode avatar Jul 08 '17 08:07 shroudedcode

Same issue here on Mac OS Sierra, npm 5.3.0

rubensbarreto avatar Jul 20 '17 00:07 rubensbarreto

Managed to install it by using yarn instead of npm In my case I was installing ngrok with exp, so I used yarn global add exp

rubensbarreto avatar Jul 20 '17 00:07 rubensbarreto

I was having the same issue with npm install -g exp. I also tried with yarn global add exp and it didnt work. What worked was installing ngrok through yarn "yarn global add ngrok" and then "yarn global add exp" and it worked

sachinharpalani avatar Sep 07 '17 13:09 sachinharpalani

for node installs on linux mint and ubuntu where it gets installed in /usr/bin/node and /usr/lib/node_modules, this did the trick for me:

$sudo yarn global add ngork --modules-folder /usr/lib/node_modules $sudo yarn global add exp --modules-folder /usr/lib/node_modules

sanchil avatar Dec 22 '17 12:12 sanchil

^^ Small typo on ngork (we want ngrok). It worked for me too! (Ubuntu)

bcollazo avatar Jan 27 '18 20:01 bcollazo

Same problem here. Using Arch linux.

AllanDaemon avatar Jan 31 '18 06:01 AllanDaemon

This is didn't work for me on a generic EC2 Linux AMI but I have it working on another EC2 Linux AMI where it works perfectly. Both instances are setup the same way but for some reason this one will not let me setup ngrok. I get the same exact error that started this thread. I've tired as root several times and rebooted, no idea whats up. Same versions between each instance.

cskonopka avatar Feb 02 '18 01:02 cskonopka

The same for my on Windows 10, I test with npm and yarn, download fine the package and never end of unpack . Any Idea of what happen??

gabe2code avatar Feb 07 '18 20:02 gabe2code

Same issue here... I was hoping this has been fixed already.

lvicentesanchez avatar Feb 12 '18 11:02 lvicentesanchez

Yeah I'm experiencing this on a brand new Ubuntu build within an ESXI environment.

LongBeachHXC avatar Feb 22 '18 16:02 LongBeachHXC

Same here, brand new Ubuntu build Xenial under virtualbox

bitbadger-io avatar Feb 23 '18 02:02 bitbadger-io

Yeah, so I downloaded ngrok directly from the source on my Ubuntu machine using wget and unzipped and placed within the usr/local/ folder and it works like a charm now.

Forrest whatever reason downloading via package manager ngrok fails.

LongBeachHXC avatar Feb 24 '18 17:02 LongBeachHXC

I removed sudo from the beginning of the command and it installed with npm (was failing with sudo)! BTW, I was installing "sudo npm install exp --global" when I saw the above error mentioned above.

pjm4 avatar Mar 06 '18 00:03 pjm4

sudo chown -R $(whoami) /usr/{lib/node_modules} should work.

ankibalyan avatar Mar 08 '18 06:03 ankibalyan

@ankibalyan doesn't work on MacOS High Sierra

breart avatar Mar 27 '18 13:03 breart

This one did the trick for me:

sudo npm i -g ngrok --unsafe-perm=true --allow-root

breart avatar Mar 27 '18 13:03 breart

brezzhnev...that also worked for me.

LongBeachHXC avatar Mar 27 '18 14:03 LongBeachHXC

@brezzhnev This is the answer. But why is this now necessary and can it be fixed?

brownbl1 avatar May 30 '18 12:05 brownbl1

@brownbl1 just grabbed from here: https://github.com/appium/appium/issues/10293#issuecomment-370334351

Actually, have no idea, would like to ask this question to devs as well :)

For me, npm is like a black box, you never know what could happen whenever you try to install or update dependencies.

breart avatar May 30 '18 19:05 breart

sudo npm i -g ngrok --unsafe-perm=true --allow-root

livesafer!

GameBitToken avatar Jan 30 '19 15:01 GameBitToken

I just saw one line with sudo, unsafe and allow-root... This is what nightmares are made of

bserem avatar Jan 30 '19 19:01 bserem

Same problem on Windows 10. Will this be fixed?

npm install ngrok --unsafe-perm=true --save

It only works with unsafe-perm param.

super-kamil avatar Apr 11 '19 12:04 super-kamil

This one did the trick for me:

sudo npm i -g ngrok --unsafe-perm=true --allow-root

It worked for me... great, thanks

technocrat2050 avatar Aug 05 '19 03:08 technocrat2050

Chiming in here in 2020 - still the same issue of not being able to find module postinstall.js

I'm on a Ubuntu 16.04.6 LTS machine, Node 12.17.0 via NVM

Surely passing sudo, --unsafe-perm=true, and --allow-root cannot be the answer?

EDIT: Just found https://github.com/bubenshchykov/ngrok/issues/115#issuecomment-380927124

It looks like until postinstall.js is removed, Linux and macOS users have to do it this way.

princefishthrower avatar Jul 27 '20 10:07 princefishthrower

if you're on a macbook with an M1 processor and faced this problem again, make sure that u're using at least the 4.2.2 package version of ngrock

good luck

safweb89 avatar Dec 20 '21 10:12 safweb89

sudo snap install ngrok worked for me in VS Code on Linux :)

parizat-hridi avatar Apr 17 '22 21:04 parizat-hridi

After Using npm i -g ngrok --unsafe-perm=true --allow-root (windows) also I get below error ngrok - downloading progress: npm ERR! ngrok - error downloading from URL RequestError: unable to get local issuer certificate

VanitaKate avatar Apr 20 '22 13:04 VanitaKate

Virtualbox Ubuntu 18.04 node version 8.16 I can't install the package by npm

[email protected] postinstall /home/ir-admin/projects/work/inreality/dms/dms-client-node/node_modules/ngrok node ./postinstall.js

ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ngrok - error downloading binary { Error: certificate has expired at TLSSocket. (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'CERT_HAS_EXPIRED' } ngrok - install failed, retrying ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ngrok - error downloading binary { Error: certificate has expired at TLSSocket. (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'CERT_HAS_EXPIRED' } ngrok - install failed, retrying ngrok - downloading binary https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ngrok - error downloading binary { Error: certificate has expired at TLSSocket. (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'CERT_HAS_EXPIRED' } ngrok - install failed { Error: certificate has expired at TLSSocket. (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'CERT_HAS_EXPIRED' }

PeacefulCosmos avatar May 19 '22 06:05 PeacefulCosmos

having the same exact issue, but on Mac OS, anyone has a clue?

mrosati84 avatar Jan 18 '23 14:01 mrosati84