So, I'm testing the new native bash on windows made by Canonical, since ubuntu doesn't have the most recent version of node and npm, I thought of instaling them using nvm.
I've created a user for me, since the bash leaves you with the root user. Then, I changed to my user and installed nvm without a problem in my /home/filipe/.nvm folder.
The problem happens when I try to run nvm install node. This is the output:
Downloading https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-x64.tar.xz...
################################################################## 100.0%
tar: bin/npm: Cannot create symlink to ‘../lib/node_modules/npm/bin/npm-cli.js’: Invalid argument
tar: Exiting with failure status due to previous errors
Binary download failed, trying source.################################################################## 100.0%
Checksums empty
tar: bin/npm: Cannot create symlink to ‘../lib/node_modules/npm/bin/npm-cli.js’: Invalid argument
tar: Exiting with failure status due to previous errors
Binary download failed, trying source.
Installing node v1.0 and greater from source is not currently supported
I thought twice before openning this issue, since the environment that I'm using is kind of a total non standard. But since your project is aimed to simplify working with node and npm in various environments, I decided to open it.
Thanks for opening it! I don't have windows bash to test anything myself, but I definitely will make changes if they're needed.
In this case, it's very difficult to figure out what the issue is. Does nvm alias foo bar work? The symlinking is being done inside the node installer itself - my guess is if you download the source manually and try to build it, it will fail in the same way.
So, I cleared my workspace and tried to install nvm again to see if it throws some kind of error that could be useful to you. There's the log:
nvm.txt
The installer throws some errors, but nvm command works nevertheless. At least nvm --version returns 0.31.0.
I hope it helps.
Yep it failed
root@localhost:~# tar xf node-v5.10.1-linux-x64.tar.xz
tar: node-v5.10.1-linux-x64/bin/npm: Cannot create symlink to ‘../lib/node_modules/npm/bin/npm-cli.js’: Invalid argument
tar: Exiting with failure status due to previous errors
The weird thing is that ln -s works just fine. Someone already reported this to Microsoft https://github.com/microsoft/bashonwindows/issues/9
Thank you for opening the issue and thanks for being open to integrate changes to support bash on Windows. I hope this will make Windows a good platform for Node developers again.
@filipeaguiar can you try this again with the latest Windows build?
I just tried it and nvm is working properly. Now it's node itself that is failing to run properly.
If you install it with either nvmor apt-get, everything always fails to run with Unknown system error -25.
@cascalheira thanks - if nvm is working fine, then it's a separate issue that should be filed on https://github.com/Microsoft/BashOnWindows.
@filipeaguiar can you confirm that this can be closed?
Installing nvm using curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash I get this as output:
Installing nvm.txt
Then, when I run nvm install node:
nvm install node.txt
After trying the command above, nvm current return _none_.
If i run nvm use --delete-prefix v6.0.0 as sugested on the output of the previous command, I get:
nvm use.txt
And nvm current outputs v6.0.0. And node can run.
But npm throws the following error:
npm.txt
Maybe it's just on my machine, but I'm running the Build 14332.rs1_release.160422-1940, that I suppose that is the most updated one for now.
@cascalheira how did you get it to work properly?
@filipeaguiar ah, i see the clone is having trouble with the test file naming. What if you temporarily uninstalled git, so that it uses curl/wget to download nvm?
@filipeaguiar @ljharb Installing without git works just fine
root@DESKTOP-7189DAB:~# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7766 100 7766 0 0 15988 0 --:--:-- --:--:-- --:--:-- 16145
=> Downloading nvm as script to '/root/.nvm'
=> Appending source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm
Installing with git gives me the same output as @filipeaguiar but nvm installs correctly.
yay for Windows filesystem limitations
I'll try.
I've installed nvm without GIT and the installation goes well. But when I try to install Node, I get this error:
filipe@KENSHIN:~$
nvm install node
Downloading https://nodejs.org/dist/v6.0.0/node-v6.0.0-linux-x64.tar.xz...################################################################## 100.0%
fs.js:634
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^Error: Unknown system error -25: Unknown system error -25, open '/home/filipe/.nvm/versions/node/v6.0.0/lib/node_modules/npm/bin/npm-cli.js'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at Object.Module._extensions..js (module.js:549:20)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:159:18)
at node.js:444:3
nvm is not compatible with the npm config "prefix" option: currently set to ""
Runnvm use --delete-prefix v6.0.0to unset it.`
Gotcha, seems like a node-windows issue.
@filipeaguiar that looks like a node problem (Same thing happened to me), and it also happens if you install node using apt-get.
So i can just assume that nvm is working properly and that its just a node problem,
Edit: When i wrote "node problem" i should have written "Windows LXss problem" as node works as intended on Ubuntu
Nice
@cascalheira Installing node from the nodesource repo works for me. The one downloaded by nvm from https://nodejs.org/dist/ gives me that Unknown system error -25 error. Dunno what the difference is between the two binaries, but it does seem like a bash for windows issue.
@ivanph Thank you! Great tip... It really works. I just tried the instalation instructions from https://github.com/nodesource/distributions#deb and it works as intended.
The difference is that the nodesource one is prebuilt for ubuntu in a different way. The binary you download from nodejs.org is probably doing something that windows doesn't support.
@ljharb Indeed, But anyway, the nodesource version is also useless: Anything you install fails to work and even npm stops working if you do npm -g update
Seems like we will have to wait a little longer :)
@cascalheira Yeah I didn't try anything besides node -v and npm -v. Sorry if I got your hopes up.
Hey everyone... just so you're all aware, this isn't an nvm issue, nor a Ubuntu issue, nor a "Windows" issue... it's a Linux Subsystem for Windows issue.
The current insider build is not capable of creating symlinks... at all. I went through a lot of pain to find th is out, but the short of the story, is that symlinking will probably not _ever_ be available at /mnt/c/Users on this subsytem.
I created a new user, which added everything to the / root filesystem, but at the moment, that doesn't work either. According to the main developer on the Linux Subsystem for Windows project, this _should_ work, but it's appparently bugged at the moment.
nvm works fine for me on "Bash on Ubuntu on Windows". I have latest version of Windows 10. I successfully installed node latest and lts and I can switch between them and both work fine.
nvm works fine for me, however it is exremely slow
@nionis if you can file a separate issue that narrows down which parts of nvm are slow on BashOnWindows, that would be very helpful.
What is the state of this issue? It is open, but several people say that it works now.
Good call, closing.
Please file separate issues if you have any problems on BashOnWindows!
Cool, thanks!
@Gheoan Can you please explain how you got nvm to work? I am not able to..
got it to work.. followed this link https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
Worked for me by using # _curl_ instead of ### _wget_ .
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
Most helpful comment
Worked for me by using # _curl_ instead of ### _wget_ .
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash