I have Ubuntu 12.10 running as a VMware guest on my Windows 8 host.
I have shared a folder on my Windows 8 Host and it is mounted in the Ubuntu guest on startup using this entry in fstab
:
//myhost/work /work cifs credentials=/home/user/.smbcredentials,noserverino,nounix,uid=user,gid=user,file_mode=0777,dir_mode=0777 0 0
The share works fine and is able to be served by a webserver such as nginx.
However, there seems to be issues when I install node.js packages using npm, I get a bunch of errors like this:
user@ubuntu:/work/test$ sudo npm install grunt
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
...
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/work/test/node_modules/grunt/node_modules/lodash'
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir '/work/test/node_modules/grunt/node_modules/lodash']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: '/work/test/node_modules/grunt/node_modules/lodash' }
npm ERR! Error: UNKNOWN, symlink '../which/bin/which'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR! System Linux 3.5.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /work/test
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! path ../which/bin/which
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR! Error: ENOENT, chmod '/work/test/node_modules/grunt/node_modules/findup-sync/test/fixtures/aaa.txt'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR! System Linux 3.5.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /work/test
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! path /work/test/node_modules/grunt/node_modules/findup-sync/test/fixtures/aaa.txt
npm ERR! fstream_path /work/test/node_modules/grunt/node_modules/findup-sync/test/fixtures/aaa.txt
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/work/test/node_modules/grunt/node_modules/minimatch/test/basic.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR! System Linux 3.5.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt"
npm ERR! cwd /work/test
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! path /work/test/node_modules/grunt/node_modules/minimatch/test/basic.js
npm ERR! fstream_path /work/test/node_modules/grunt/node_modules/minimatch/test/basic.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/work/test/node_modules/grunt/node_modules/glob/test/00-setup.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
...
npm ERR! not ok code 0
user@ubuntu:/work/test$
What could be causing this problem? From the command line, I can chmod
, rmdir
among other things using sudo without any issues.
Running with
--no-bin-links
fixed it for me:--no-bin-links
tellsnpm
to not create any symbolic links.Occasionally, for some packages that create symlinks even with the
--no-bin-links
directive, or in the case where using this directive causes other errors, you can remove the symlinks from the package(s) that is showing error with the command:There is definitely no way to translate symlinks to a Windows share.
How to allow creating symlinks on windows this page helped me a lot which explains that this happens even if your shared folder is writable.
To fix it, you need to enable symlinks feature in VirtualBox.
Run at cmd prompt:
Then verify by:
Agree with lorem, but it's not enough.
run Virtualbox 'as an admininstrator' on Windows.
make sure you executed:
VBoxManage.exe setextradata YOUR_VM BoxInternal2/SharedFoldersEnableSymlinksCreate/YOUR_SHARED_FOLDER 1
Replace the YOUR_VM and YOUR_SHARED_FOLDER with your values. You can check the value via:
VBoxManage.exe getextradata boot2docker-vm enumerate
There is a virtualbox bug tracking this issue.
The newer versions of VirtualBox should allow symlinks if you start VirtualBox as Adminstrator (right click: Run as administrator).
Same applies to vagrant boxes: just run your cmd.exe/PowerShell as admin and you are good to go.
in this npm issue @drmyersii give a great solution, I'll only copy and paste to don't link the answer only.
this worked great for me and now I can use gulp with scotchbox.
For me none of these answers worked. I'm not sure why but I believe it's because my share is nfs. So I couldn't get it to allow symlinks even when running as Administrator and changing the setextradata settings. I was working with gulp and some other packages that seem to have issues obeying --no-bin-links. It was STILL trying to create some symbolic links and obviously failing. Finally this thread on Github clued me into a "solution", hacky as it may be. I "simply" installed the project in my non-shared folder and set that as my NODEPATH.
Caveat is that it will affect the entire server and the workflow of updating/changing the packaging.