Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ovidiu_dtp's avatar

npm install on a virtual machine under a base Windows system

I installed homestead under VirtualBox. it all worked great until I had to run this:

vagrant@homestead:~/Code/Laravel$ sudo npm install
npm ERR! Error: UNKNOWN, symlink '../user-home/cli.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.16.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/vagrant/Code/Laravel
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path ../user-home/cli.js
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR! not ok code 0

I posted this before, on this forum. Some people hinted at the fact that VMware is a much better provider, and the reason I get this error, is probably because I use VirtualBox. That is why, I purchased a licence for VMware and the plugin for workstation.

I installed VMware, I uninstalled VirtualBox, I changed the provider, in the yaml file, and booted the new VM. All worked nice. Then I went cd Code/Laravel. Then, again

vagrant@homestead:~/Code/Laravel$ sudo npm install
npm ERR! Error: UNKNOWN, symlink '../user-home/cli.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.16.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/vagrant/Code/Laravel
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path ../user-home/cli.js
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR! not ok code 0

This problem is extremely frustrating. I expected that it will just go away with the payed version of the software but it was not so. This post is a warning for those who expect that purchasing a licence will just solve the problem. It wont. In the same time, is a call for help, from those who know better how to deal with this situation and make npm work on VM's that use Windows based systems.

I do not know if this is the best cathegory for this post... but it is not a trick, is kind of a request, but I know that @jeff_way is not a huge fan of windows in the first place, so is more of a request for community for help... So, please help, if you know how.

0 likes
29 replies
ovidiu_dtp's avatar

Doing that, had this effect:

vagrant@homestead:~/Code/Laravel$ sudo npm install --no-bin-links
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/concat-stream requires readable-stream@'~1.1.9' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/duplexer2 requires readable-stream@'~1.1.9' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/module-deps requires readable-stream@'^1.0.27-1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/read-only-stream requires readable-stream@'^1.0.31' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/stream-browserify requires 
readable-stream@'^1.0.27-1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/labeled-stream-splicer/node_modules/
stream-splicer requires readable-stream@'^1.1.13-1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/browserify/node_modules/read-only-stream/node_modules/readable-wrap requires readable-stream@'^1.1.13-1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-elixir/node_modules/
gulp-sass/node_modules/node-sass/node_modules/pangyp/node_modules/fstream/node_modules/
rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-
elixir/node_modules/gulp-sass/node_modules/node-sass/node_modules/
pangyp/node_modules/glob,
npm WARN unmet dependency which is version 4.3.5
ovidiu_dtp's avatar

Thank you for your help. Some progress is in range. I had

vagrant@homestead:~/Code/Laravel$ npm -v
1.4.28

But then, this happened:

vagrant@homestead:~/Code/Laravel$ sudo npm install npm -g
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
npm@2.7.5 /usr/lib/node_modules/npm
vagrant@homestead:~/Code/Laravel$ npm -v
2.7.5
vagrant@homestead:~/Code/Laravel$ sudo npm install --no-bin-links
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-elixir/node_modules/gulp-
sass/node_modules/node-sass/node_modules/pangy                                                             
p/node_modules/fstream/node_modules/rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-elixir/node_modules/gulp-
sass/node_modules/node-sass/node_modules/pangy                                                              p/node_modules/glob,
npm WARN unmet dependency which is version 4.3.5
vagrant@homestead:~/Code/Laravel$ gulp
module.js:340
    throw err;
      ^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)

After all this, I upgraded my node js using info from here: http://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

but in the end, I got:

vagrant@homestead:~/Code/Laravel$ sudo npm install --no-bin-links
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-elixir/node_modules/gulp-
sass/node_modules/node-sass/node_modules/pangyp/node_modules/fstream/node_modules/rimraf requires 
glob@'^4.4.2' but will load
npm WARN unmet dependency /home/vagrant/Code/Laravel/node_modules/laravel-elixir/node_modules/gulp-
sass/node_modules/node-sass/node_modules/pangyp/node_modules/glob,
npm WARN unmet dependency which is version 4.3.5
vagrant@homestead:~/Code/Laravel$

Gulp, also failed.

ovidiu_dtp's avatar

I noticed and even posted in that thread. However, that problem is in the default setup, with virtualbox. This fails even with VMware. Maybe I should have posted in that thread... anyway, a solution is not yet available for this problem.

What puzzles me, is that the npm install fails even in folders that are not shared, but are native on the VM.

I tried to copy the file package.json to ~, I went there and used

sudo npm install

and I got the same error message... I had the wrong understanding that this is a problem only with the shared folder...

bashy's avatar

Oh sorry, I did check a few replies down but did see it was 5 months old.

Maybe you have to set your npm prefix?

npm config set prefix ~/npm
jimmck's avatar

What version of sass do you have? Is there a way to set Vagrant back to default install?

jimmck's avatar

also why are you installing npm over it self? y

ovidiu_dtp's avatar

@bashy I will try that when I get back home. I am at work now. @jimmck If I fail with what bashy suggested, I will try to wipe it all clean and see how that will work. But considering that other people had the same problem, I do not think it will solve the problem. But it may be worth it to try.

I install npm over itself because this is what was suggested on askubuntu in order to upgrade it. I should have done it differently?

I really want to get this going. I hope I will not be forced to install Linux on my main machine for it to work. I plan to do this at some point, just not right now.

jimmck's avatar

I think you just have version nightmares. I had this last week trying to install amazon S3 package in Laravel. It took lots of Googling and patience, but it came out ok. I think npm install -g stable will get you started. Also are you on ubuntu?

ovidiu_dtp's avatar

Like I said, I had purchased the licence for Vagrant, and I asked them about the problem.

This is the answer I got:

Thank you for reaching out, and I am sorry you are having issue with the Vagrant VMware Workstation plugin. As 
described on the issue, the root cause of the problem is not tied to a particular virtualization software, but rather a 
restriction in the Windows operating system itself. Regardless of whether you were using VirtualBox, VMware, or 
Parallels, you would see this error unless you used a UNC path.

As you can see from the pull request I have linked below, this is not an issue with any provider specifically, but rather all 
of them:

https://github.com/mitchellh/vagrant/pull/5495
Once that fix is available in Vagrant core, the Vagrant VMware provider can leverage the non-UNC->UNC path 
conversion. This process, however, will require both a new release of Vagrant and a new release of the Vagrant 
VMware provider. As such, it may be a few weeks until the fix is readily available.

In light of these circumstances, I have refunded the full purchase price of the plugin. You can continue to use the plugin 
free of charge. At HashiCorp, we never want to see an unhappy customer, and I am sorry if you feel you were misled 
during this process.

Please let me know if you have any questions.

I do not know how t o make that look like a quote... I will look into it and may edit later. @bashy and @jimmck, thank you for your help, but it looks like Windows sucks...

Since I purchased a licence for VMware, I will install Ubuntu in the virtual machine, and I will make the servere in that machine, after that I will connect with PHPStorm by FTP to the files on the server and have them synced by phpstorm with my VM. I do not like this idea, of having the files in 2 places at once... but I will see how it works. I will not use Vagrant, tho. I will end up learning more stuff about tinkering with Linux and configuring server side stuff than I wanted to learn... but it had to be done eventually anyway.

If any of you has a better idea, please share.

bashy's avatar

Yeah Windows really doesn't do dev work well.

Quote is using a greater than symbol on it all ">"

This is a quote

jimmck's avatar

Note:

When creating an ODBC driver for use in mapping a drive, the ODBC dialog disappears during the step when you select a Workbook and choose a folder and Workstation crashes.

Workaround: Do not map any VMware shared folders as drive letters. Use the Universal Naming Convention (UNC) paths instead, for example: \vmware-host\Shared Folders\

From: https://rstforums.com/forum/86904-keys-vmware-workstation-10-0-1-1379776-a.rst

jimmck's avatar

It would seem to me at least: The Git request is more of a wish than a bugfix. I could be wrong.

ovidiu_dtp's avatar

I did something, in the virtual machine with Vagrant.

cp package.json /tmp
cd /tmp
sudo npm install

The strange part is that it worked in that folder... you think I can use this for some kind of a workaround? Maybe I can make a working folder someplace, and not have it shared with Windows. I will try to install an ftp server in Homestead and work by connecting to the server by FTP.

jimmck's avatar

When you created the share did you use UNC syntax or usual syntax with drive letters. Also your /tmp shows the path length issue. What I have read seems to stress using UNC syntax for paths. Not go off topic, but you should be able to use the DOS junction command to create short alias's to your path.

Jim

jimmck's avatar

This is what I am looking for:

https://harvsworld.com/2014/07/change-vagrant_home-directory-windows/

Notice the DOS command to set the environment var:

set VAGRANT_HOME=X:\PATH\TO\VAGRANT

It uses the drive letter syntax. Change this to UNC format. You will see links to this in the two posts I made prior to your last post.

http://www.howtogeek.com/118452/how-to-map-network-drives-from-the-command-prompt-in-windows/

The Google link: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=changing%20your%20dos%20drive%20letter%20syntax%20to%20unc

--Jim

jimmck's avatar

For an experiment: share your folder for vagrant install

your UNC should be \<your computer name<share name>

if I share my c:\ as C the UNC on my win7 is \jim-pc\c

where C is the share name.

jim-pc is my computer name.

ovidiu_dtp's avatar

@jimmck I will check and see if it works with your advice. But I managed to find a workaround

I think this will end up showing how noob I am... I installed node in windows. I installed npm in windows. I deleted node_modules folder. I used npm install in windows. It worked.

The reason it failed before in windows looks like it was because I never deleted node_modules folder before running the npm install command.

The funny thing is that it also works in VM after I installed it in Windows, but it crashes when I run the gulp command because it won't deal with the notification plugin, for some reason. But I can work with gulp in windows now, and everything seems fine.

The problem is that I made it work and I do not feel like I learned much of anything. But I am happy it works.

jimmck's avatar

@ovidiu_dtp I am glad you got it working. I don't use VMWARE right now. I moved from development on Windows to a MAC. I also converted all my Window's machines except one to Ubuntu. If you ever get the chance to try out the UNC pathing I would be interested in knowing. I will probably need to be build out a VM box any day now :) Everybody is a NOOB at some point during the day. Happy Developing.

Jim

barrybenroth's avatar

I am trying to do the same thing. I have windows 10 pro with the virtualbox laravel-homestead set up on a virtual machine. I now want to get npm and bower working. It would be great if you could summarize the path you feel worked. it is a little confusing to sift through the exchange. As i understand it - one first has to go to node.js and download that. Then do the npm install. But it isn't immediatley clear whether should be downloading to the windows (host) machine or the virtual machine running ubuntu. Anytime we are using sudo it means we are in the ubuntu (linux, etc) environment - but the documentation shows the sudo approach and not using the dos command level option, even when having downloaded to windows I have mostly worked in windows but am starting to support aweb site project via this virtual machine configuration. It would be great if there were one piece of documentation tying it all together. I may try and write something like that up if i can figure how to get it all working together to begin with. Anyhow appreciate response and thanks for raising question and for the responses.

outboundexplorer's avatar

@brianmerrit has got it spot on here. I have seen in other places people also suggesting that perhaps it is necessary to install the VirtualBox Extension Pack. This however seems to do nothing to help with this issue. This seems to be the way forwards.

npm install --no-bin-links

dragon788's avatar

You have to do a couple workarounds, but you can definitely do this on Windows with Virtualbox (and Vagrant).

http://blog.prolificinteractive.com/2015/01/21/getting-vagrant-nodejs-windows-play-well-together/ has all the magic you need, the main pieces are enabling symlinks for Virtualbox as an extra option, and then altering the file ACLs for Windows to actually allow the symlinks to work.

The most important step is REBOOT, if you don't, it won't appear to work, but after a restart it will.

Zaven's avatar

Hey guys! You can also find some good advice and tips here: https://blog.zaven.co/ These guys explain everything really clearly and make it all easy! Check it and let me know if it was useful!

Please or to participate in this conversation.