Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Failed to install with npm 5.6.0 #62

Open
DarrylD opened this issue Dec 23, 2017 · 16 comments
Open

Failed to install with npm 5.6.0 #62

DarrylD opened this issue Dec 23, 2017 · 16 comments

Comments

@DarrylD
Copy link

DarrylD commented Dec 23, 2017

macair:app $ npm --version
5.6.0
macair:app $ npm install -g https://github.com/reasonml/reason-cli/archive/3.0.4-bin-darwin.tar.gz
/usr/local/bin/ocamlmerlin-reason -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlmerlin-reason
/usr/local/bin/refmt -> /usr/local/lib/node_modules/reason-cli/.bin/refmt
/usr/local/bin/reactjs_jsx_ppx_v2 -> /usr/local/lib/node_modules/reason-cli/.bin/reactjs_jsx_ppx_v2
/usr/local/bin/reactjs_jsx_ppx_v3 -> /usr/local/lib/node_modules/reason-cli/.bin/reactjs_jsx_ppx_v3
/usr/local/bin/reason-cli-esy-sandbox -> /usr/local/lib/node_modules/reason-cli/.bin/reason-cli-esy-sandbox
/usr/local/bin/refmttype -> /usr/local/lib/node_modules/reason-cli/.bin/refmttype
/usr/local/bin/utop -> /usr/local/lib/node_modules/reason-cli/.bin/utop
/usr/local/bin/rtop -> /usr/local/lib/node_modules/reason-cli/.bin/rtop
/usr/local/bin/rebuild -> /usr/local/lib/node_modules/reason-cli/.bin/rebuild
/usr/local/bin/reopt -> /usr/local/lib/node_modules/reason-cli/.bin/reopt
/usr/local/bin/ocamlmerlin -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlmerlin

> [email protected] postinstall /usr/local/lib/node_modules/reason-cli
> ./bin/esyBuildRelease bin install

usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `./bin/esyBuildRelease bin install`
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.¶
@cirpo
Copy link

cirpo commented Dec 28, 2017

👍 same here.

@cirpo
Copy link

cirpo commented Dec 28, 2017

same issues here.
MacOs 10.13.2, npm 5.6 and node 9.2.0.

To fix it, I ran npm install with the --ignore-scripts flag to not execute the faulty post-install script:

npm install -g --ignore-scripts  https://github.com/reasonml/reason-cli/archive/3.0.4-bin-darwin.tar.gz

inside the installation dir .nvm/versions/node/v9.2.0/lib/node_modules/reason-cli/
I had to change the file ownership and group because they were totally wrong:

ll ~/.nvm/versions/node/v9.2.0/lib/node_modules/reason-cli/r/build-eject/bin/esyImportBuild
-rwx------  1 653775386  1876110778  
sudo chown -R $USER r

execute the postinstall script with sudo

sudo ./bin/esyBuildRelease bin install

and everything worked.

It could be that passing --unsafe-perm to the npm install could fix the issue as well but I didn't try it as I already spent 2 hours trying to fix the issue.

@jordwalke
Copy link
Member

@cirpo Did you try npm install -g with sudo?

Does nvm remove the need to use sudo?

@cirpo
Copy link

cirpo commented Dec 30, 2017

@jordwalke I didn't (I tend to avoid to use sudo as much as I can)

In the next days I will try to replicate different scenarios, I'll keep you posted.

@jordwalke
Copy link
Member

Thanks, it's pretty common to have to use sudo to install global packages. It's so annoying that I almost always recommend this other approach to avoid ever having to use sudo.
I'm trying to tell if this issue you're experiencing is just run of the mill npm sudo issues, vs. something specific to reason-cli.

@DarrylD
Copy link
Author

DarrylD commented Dec 30, 2017

I used sudo along --unsafe-perm and still have the same issue. Still trying to solve the issue but, I'm not using nvm.

@jordwalke
Copy link
Member

What about sudo without unsafe perm? Can you specify your OS/distro?

@cirpo
Copy link

cirpo commented Dec 30, 2017 via email

@DarrylD
Copy link
Author

DarrylD commented Dec 31, 2017

@jordwalke I'm on OS X Yosemite 10.10.5

@ericnograles
Copy link

Just wanted to parrot in here, I'm also on an NVM setup, OS X High Sierra (10.13.2) and exhibited the same problems that @DarrylD and @cirpo had, both sudo and non-sudo.

@jordwalke to answer your question, yes, NVM basically redirects to a "user safe" spot for Node installations, allowing one to switch versions at will and not have to use sudo for global installations.

I tried @cirpo's fix where we drop in --ignore-scripts, change the ownership of r.tar.gz, and then ran sudo ./bin/esyBuildRelease bin install in the reason-cli directory of my globals, and it looks like it worked:

image

@jordwalke
Copy link
Member

cc @andreypopp any clue what this could be (nvm installs should require less permissions than regular npm/node installations I thought)

@andreypopp
Copy link
Collaborator

I tried to repro this but no luck.

My system:

% uname -a
Darwin Andreys-MacBook-Pro.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
% node -v
v9.2.0
% npm version
{ npm: '5.6.0',
  ares: '1.13.0',
  cldr: '32.0',
  http_parser: '2.7.0',
  icu: '60.1',
  modules: '59',
  nghttp2: '1.25.0',
  node: '9.2.0',
  openssl: '1.0.2m',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.16.1',
  v8: '6.2.414.44-node.11',
  zlib: '1.2.11' }
% which node
/Users/andreypopp/.nvm/versions/node/v9.2.0/bin/node
% which npm
/Users/andreypopp/.nvm/versions/node/v9.2.0/bin/npm

How did you install nvm? I did:

% curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

To me this sounds like either an npm bug which extract with incorrect permissions in some occasions (I saw something like this on npm bugtracker but they reported those bugs are fixed now) or an incorrect nvm env setup.

@cirpo
Copy link

cirpo commented Jan 2, 2018 via email

@4423Q
Copy link

4423Q commented Feb 2, 2018

There's two different issues going on here it looks like.
@DarrylD 's issue is caused by the behaviour of mktemp in Yosemite and earlier, and I've reproduced it on a 10.10 box. More info on the differences and solutions here: https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x

"Fix" for this is to install with --ignore-scripts, find node_modules/reason-cli, patch r.tar.gz so the files r/build-eject/bin/esyImportBuild and r/build-eject/bin/esyExportBuild use mktemp -d -t 'esytmpdir' in place of mktemp -d and then run ./bin/esyBuildRelease bin install à la @cirpo.

This hack works and solves the problem but I'll look into how we can fix this properly.

@hath
Copy link

hath commented Feb 3, 2018

I was having this issue on node v9.5.0 / npm 5.6.0 and debian stretch until I installed gcc/g++, which appears to be required?

@sbaudray
Copy link

sbaudray commented Feb 24, 2018

@hath Thank you, i was having this error on Linux Mint:

/usr/lib/node_modules/reason-cli/r/build-eject/Makefile:1040: recipe for target '/usr/lib/node_modules/reason-cli/r/build-eject//bin/fastreplacestring.exe' failed

I ran:

sudo apt install build-essential
npm i -g [email protected]

And i'm good now. Docs do mention glibc but i didn't find how to install it, i did with g++.

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

No branches or pull requests

8 participants