reason-cli icon indicating copy to clipboard operation
reason-cli copied to clipboard

Can't install with npm 5.3.0

Open JimVanEeden opened this issue 8 years ago • 20 comments

When trying to install with npm install -g https://github.com/reasonml/reason-cli/archive/beta-v-1.13.6-bin-linux.tar.gz, using npm 5.3.0, the installation fails with the following error:

/usr/local/bin/ocamlmerlin -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlmerlin
/usr/local/bin/ocamlmerlin-reason -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlmerlin-reason
/usr/local/bin/ocamlrun -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlrun
/usr/local/bin/ocamlc -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlc
/usr/local/bin/ocamlc.opt -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlc.opt
/usr/local/bin/ocamlopt -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlopt
/usr/local/bin/ocamlopt.opt -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlopt.opt
/usr/local/bin/rtop -> /usr/local/lib/node_modules/reason-cli/.bin/rtop
/usr/local/bin/ocaml -> /usr/local/lib/node_modules/reason-cli/.bin/ocaml
/usr/local/bin/utop -> /usr/local/lib/node_modules/reason-cli/.bin/utop
/usr/local/bin/refmt -> /usr/local/lib/node_modules/reason-cli/.bin/refmt
/usr/local/bin/refmttype -> /usr/local/lib/node_modules/reason-cli/.bin/refmttype
/usr/local/bin/reopt -> /usr/local/lib/node_modules/reason-cli/.bin/reopt
/usr/local/bin/rebuild -> /usr/local/lib/node_modules/reason-cli/.bin/rebuild
/usr/local/bin/reactjs_jsx_ppx -> /usr/local/lib/node_modules/reason-cli/.bin/reactjs_jsx_ppx
/usr/local/bin/reactjs_jsx_ppx_2 -> /usr/local/lib/node_modules/reason-cli/.bin/reactjs_jsx_ppx_2
/usr/local/bin/berror -> /usr/local/lib/node_modules/reason-cli/.bin/berror
/usr/local/bin/menhir -> /usr/local/lib/node_modules/reason-cli/.bin/menhir
/usr/local/bin/ocamlfind -> /usr/local/lib/node_modules/reason-cli/.bin/ocamlfind
/usr/local/bin/reason-cli -> /usr/local/lib/node_modules/reason-cli/.bin/reason-cli

> [email protected] postinstall /usr/local/lib/node_modules/reason-cli
> ./postinstall.sh

gzip: rel.tar: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `./postinstall.sh`
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!     /home/jim/.npm/_logs/2017-07-26T12_10_30_040Z-debug.log

Using my previous npm version (4.1.2), the installation does work. Haven't tried any other versions of npm, just thought you should know this.

JimVanEeden avatar Jul 26 '17 12:07 JimVanEeden

I also encountered this issue on Arch linux.

adam-bernau avatar Aug 25 '17 18:08 adam-bernau

Same issue on OSX 10.12.6 and npm 5.3.0.

charlesgiroux avatar Aug 27 '17 18:08 charlesgiroux

Thank you for reporting.

jordwalke avatar Aug 28 '17 06:08 jordwalke

I think this is a legitimate issue because I just tried on npmc (their canary). I previously have had no problems with npmc, so something changed with how either npm handles permissions, or how we alter permissions on our releases. Old npm still works well for me, as you've noted.

jordwalke avatar Aug 28 '17 06:08 jordwalke

I found that when I do npmc install -g --ignore-scripts reason-cli-url, the resulting directory looks like this:

total 184
drwxr-xr-x  16 me  1876110778   544B Aug 27 23:59 ./
drwxr-xr-x   6 me  1876110778   204B Aug 27 23:59 ../
drwxr-xr-x  22 me  1876110778   748B Aug 27 23:59 .bin/
-rw-r--r--   1 me  1876110778    10B Jul  9 17:55 .npmignore
-rw-r--r--   1 me  1876110778   407B Jul  9 17:55 .travis.yml
-rw-r--r--   1 me  1876110778   1.0K Jul  9 17:55 LICENSE
-rw-r--r--   1 me  1876110778   714B Jul  9 17:55 Makefile
-rw-r--r--   1 me  1876110778   184B Jul  9 17:55 ORIGINS.md
-rw-r--r--   1 me  1876110778   6.6K Jul  9 17:55 README.md
-rw-r--r--   1 me  1876110778   3.3K Aug 27 23:59 package.json
-rw-r--r--   1 me  1876110778    11K Jul  9 17:55 postinstall.sh
-rw-r--r--   1 me  1876110778    11K Jul  9 17:55 prerelease.sh
drwxr-xr-x   5 me  1876110778   170B Aug 27 23:59 records/
-rw-r--r--   1 me  1876110778    33K Jul  9 17:55 rel.tar.gz
drwxr-xr-x   3 me  1876110778   102B Aug 27 23:59 relBinaries/
drwxr-xr-x   4 me  1876110778   136B Aug 27 23:59 releaseUtils/

npmc has removed the executable permissions from postinstall.sh! This might be a bug on their end, or a new security feature. Does anyone know?

jordwalke avatar Aug 28 '17 07:08 jordwalke

This issue supposedly says it's fixed, but it still looks broken to me (in the latest canary (5.4 canary 1)).

jordwalke avatar Aug 28 '17 07:08 jordwalke

I've filed an issue here on npm's repo. It looks like it's a bug in npm5 :(

jordwalke avatar Aug 28 '17 07:08 jordwalke

We can do sh ./postinstall.sh as a workaround?

andreypopp avatar Aug 28 '17 07:08 andreypopp

@andreypopp Yes, you should be able to do npmc install -g --ignore-scripts theUrl, and then cd into the npm install location, then chmod 777 postinstall.sh, and then ./postinstall.sh. But if it's the case that npm5 is messing up permissions upon installation, then I would say that npm5 isn't ready for use yet. If it's something we're doing incorrectly, that's another story but so far it looks like a pretty clear cut case of an npm bug.

jordwalke avatar Aug 28 '17 19:08 jordwalke

@jordwalke thanks for answer. It help! A little hint who stucked with that problem too: npm global packages folder can be found by $ npm list -g. For example, at Fedora path is /usr/lib/node_modules/reason-cli/

e41q avatar Sep 28 '17 16:09 e41q

What did you have to do to get it working?

jordwalke avatar Sep 29 '17 02:09 jordwalke

Same issue on OSX 10.12.6 , node 8.7.0 and npm 5.4.2

mikowiec avatar Oct 23 '17 09:10 mikowiec

@mikowiec do you use nvm or something like that or this was just plain brew install of Node?

andreypopp avatar Oct 23 '17 11:10 andreypopp

do you use nvm or something like that or this was just plain brew install of Node?

No, I've installed the latest release node-v8.7.0.pkg from nodejs.org I've make workaround with postinstall.sh and installation finished well. But, the similarly issue occurred when I installed "bs-platform" for testing purposes.

I've uninstalled v8.7 and then installed LTS node-v6.11.4.pkg (where is npm 3.10.10). Then installed "bs-platform" and made the simple project. It was OK for LTS and fault for latest node (npm).

update: brew installed node gave the same issue

mikowiec avatar Oct 23 '17 12:10 mikowiec

My NPM version is 5.5.1 and I still had this issue. Jordan's workaround above worked fine though.

adrianmcli avatar Nov 27 '17 23:11 adrianmcli

@adrianmcli and what is your OS? Are you using the npmc canary? or official npm release?

jordwalke avatar Nov 28 '17 06:11 jordwalke

@jordwalke I was using official npm release 5.5.1 on Mac OS 10.12.6 Sierra. Willing to try other combinations if you'd like.

adrianmcli avatar Nov 28 '17 07:11 adrianmcli

Same issue with npm 5.6.0

cirpo avatar Dec 28 '17 17:12 cirpo

As explained in the other opened issue, I fixed it in this way:

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.

cirpo avatar Dec 28 '17 22:12 cirpo

On Mac OSX 10.13 you have to add --unsafe-perm

npm install -g --unsafe-perm electron-icon-generator

countrdd avatar Jan 14 '18 11:01 countrdd