Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation fails on postinstall #2291

Closed
benediktwerner opened this issue Nov 23, 2017 · 4 comments
Closed

Installation fails on postinstall #2291

benediktwerner opened this issue Nov 23, 2017 · 4 comments

Comments

@benediktwerner
Copy link

When installing with npm install -g bs-platform on WSL I get the following error:

/root/.npm-global/bin/bsb -> /root/.npm-global/lib/node_modules/bs-platform/lib/bsb
/root/.npm-global/bin/bsc -> /root/.npm-global/lib/node_modules/bs-platform/lib/bsc
/root/.npm-global/bin/bsrefmt -> /root/.npm-global/lib/node_modules/bs-platform/lib/bsrefmt

> [email protected] postinstall /root/.npm-global/lib/node_modules/bs-platform
> node scripts/install.js

module.js:538
    throw err;
    ^

Error: Cannot find module '/root/.npm-global/lib/node_modules/bs-platform/scripts/install.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/install.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-11-23T00_04_13_596Z-debug.log

Node version: 8.9.1
NPM version: 5.5.1
OCaml version: 4.02.3

Any ideas how to fix this?

@bobzhang
Copy link
Member

bobzhang commented Nov 23, 2017

bucklescript works on windows natively -- I will see if I can reproduce it on WSL
btw, there are lots of bugs in npm5, we came to it lots of times, can you try also on npm4 and yarn

@bobzhang
Copy link
Member

feel free to reopen it if you still have such issue, or anyone see this happen again

@kentnek
Copy link

kentnek commented Jan 23, 2018

I'm having the same problem, while trying to follow this guide. However, instead of WSL, I'm installing bs-platform inside a Ubuntu 16.04 docker image.

> [email protected] postinstall /root/.npm-global/lib/node_modules/bs-platform
> node scripts/install.js

module.js:540
    throw err;
    ^

Error: Cannot find module '/root/.npm-global/lib/node_modules/bs-platform/scripts/install.js'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/install.js`
npm ERR! Exit status 1

As you can see, both @benediktwerner and I mkdir this directory ~/.npm-global to fix the NPM permission issue, which explains why the folder appeared in the error log.

Any idea why this is happening? Thanks!

UPDATE:
Oh it seems the script is there, but npm will not execute scripts when running as root (as mentioned here. Turns out upon being unable to execute the script, npm for some reason showed the Cannot find module error instead.

TL;DR: just run npm install -g bs-platform --unsafe-perm and it should work.

@kaashyapan
Copy link

kaashyapan commented Mar 6, 2018

After an entire day of trying to get bucklescript in a container(debian) running as root.
The above update finally worked!
npm install -g bs-platform --unsafe-perm

node -v :- 8.9.4

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

No branches or pull requests

4 participants