reasonml / ReasonNativeProject

Reason native compilation starter project
MIT License
203 stars 45 forks source link

NPM Install failing on Ubuntu 16.04.1 #16

Closed mattferderer closed 7 years ago

mattferderer commented 7 years ago

I'm running a docker container of Ubuntu 16.04.1 on Windows 7. I'm getting the following error while trying to do npm install --no-bin-links:

npm ERR! opam-installer-bin@0.0.0 postinstall: `eval $(dependencyEnv) && nopam && make install'

I have the following installed: node 7.5.0 npm 4.1.2 m4 1.4.17 ocaml 4.02.3

I started a repo to share if anyone wants to duplicate my steps: docker-reason-project. Hopefully this is helpful to other Windows users if I can get it working.

vramana commented 7 years ago

Can you post the error log?

mattferderer commented 7 years ago

The log file is attached. npm-debug.txt

adrianmcli commented 7 years ago

I had the exact same error when running npm install on a freshly cloned project, but I fixed it by uninstalling Node/NPM and reinstalling everything. I know this isn't particularly helpful, sorry.

mattferderer commented 7 years ago

Thanks @adrianmcli. I'm not sure if that would help in this case as I'm using Docker & installing everything from scratch in a sense every time I build & boot it up.

adrianmcli commented 7 years ago

How are you installing node/npm? I found out that I had a faulty installation of n, which is why I ripped everything out and installed it back.

mattferderer commented 7 years ago

As of right now, I'm starting with the default 16.04.1 Ubuntu container and running these commands:

apt-get -qq update
apt-get install -y curl git m4 ocaml apt-utils
curl -sL https://deb.nodesource.com/setup_7.x | bash -
apt-get install -y nodejs build-essential
update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

Then I npm install --no-bin-links this repo.

vramana commented 7 years ago

I left this comment on your repo as well ICYMI

You don't need ocaml. And It may potentially conflict with reason's version. m4 will installed along with build-essential so you can omit it here.

adrianmcli commented 7 years ago

Can confirm, I ripped out all my OCaml stuff prior to getting this to work as well. This includes OPAM and a couple others I forgot. It would be nice if Reason can eventually be fully sandboxed.

mattferderer commented 7 years ago

I did notice that comment @vramana. I'll give it a try again without ocaml or m4 & report back. That did result in a different error.

vramana commented 7 years ago

If you get a different error, probably it's race condition. Always paste the error log. Don't use loglevel silly just regular npm output is enough.

mattferderer commented 7 years ago

Here's the regular npm output running without m4 & ocaml in the install.

root@6afa70f7cf98:/ReasonProject/ReasonProject# npm install --no-bin-links

> opam-installer-bin@0.0.0 postinstall /ReasonProject/ReasonProject/node_modules/opam-installer-bin
> eval $(dependencyEnv) && nopam && make install

sh: 1: dependencyEnv: not found
sh: 1: nopam: not found
ReasonProject@0.0.1 /ReasonProject/ReasonProject
`-- (empty)

npm ERR! Linux 4.4.43-boot2docker
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--no-bin-links"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! opam-installer-bin@0.0.0 postinstall: `eval $(dependencyEnv) && nopam && make install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the opam-installer-bin@0.0.0 postinstall script 'eval $(dependencyEnv) && nopam && make install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the opam-installer-bin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eval $(dependencyEnv) && nopam && make install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs opam-installer-bin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls opam-installer-bin
npm ERR! There is likely additional logging output above.
vramana commented 7 years ago

I don't think you should pass --no-bin-links. Did you read it anywhere?

mattferderer commented 7 years ago

It was suggested by a on the ReasonML Discord chat. This issue was referenced - https://github.com/npm/npm/issues/9901

I'll give it a try again without it. Also seems that m4 didn't come with build-essentials as it doesn't appear to be installed. Would I need to check some other way besides m4 --version?

mattferderer commented 7 years ago

So I tried without ocaml & m4 installed & had the error referenced above. Installing m4, deleting node_modules & reinstalling the node modules brought me the same error. I then tried removing node_modules again & installing with just npm install & left off the --no-bin-links. That left me at this error:

npm ERR! Linux 4.4.43-boot2docker
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! path /ReasonProject/ReasonProject/node_modules/.staging/ocaml-2cf69ce2
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall rename

npm ERR! Error
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:29:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:284:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:112:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename '/ReasonProject/ReasonProject/node_modules/.staging/ocaml-2cf69ce2' ->
'/ReasonProject/ReasonProject/node_modules/ocaml'
npm ERR!  { Error
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:29:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:284:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:112:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename '/ReasonProject/ReasonProject/node_modules/.staging/ocaml-2cf69ce2' ->
'/ReasonProject/ReasonProject/node_modules/ocaml' parent: 'ReasonProject' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /ReasonProject/ReasonProject/npm-debug.log

Which leads me back to https://github.com/npm/npm/issues/9901 as the fix. I am running this as an administrator on Windows & in Ubuntu am the root user. May I can look at this a bit closer though as it may be the real issue here.

subtleGradient commented 7 years ago

I followed the instructions here to get the correct version of node and npm installed. https://aigeec.com/installing-node-js-on-windows-10-bash/

mattferderer commented 7 years ago

It does work fine using Windows 10 with the new Ubuntu Bash. Once again, you need to make sure m4 is installed which isn't mentioned in Reason's installation instructions. I'm going to close this issue & say that this is a Windows/Docker issue.