1

I am trying to set up a CentOS 7 as my development box in Virtual Box 5.0.2. I share the project folder from the host, that is running windows 7, with the guest (then I can use the windows GUI and use an IDE to do the interaction on windows, while my code is running on CentOS).

I am doing some development in node. While setting up my project and doing npm install, I got an error as:

49132 error Linux 3.10.0-327.13.1.el7.x86_64
49133 error argv "/home/wdd/nvm/versions/node/v5.10.0/bin/node" "/home/wdd/nvm/versions/node/v5.10.0/bin/npm" "install"
49134 error node v5.10.0
49135 error npm  v3.8.3
49136 error path /home/wdd/share/mynps-corporate-client/node_modules/.staging/iconv-lite-94545a9f
49137 error code EPERM
49138 error errno -1
49139 error syscall rename
49140 error Error: EPERM: operation not permitted, rename '/home/wdd/share/mynps-corporate-client/node_modules/.staging/iconv-lite-94545a9f' -> '/home/wdd/share/mynps-corporate-client/node_modules/iconv-lite'
49140 error     at destStatted (/home/wdd/nvm/versions/node/v5.10.0/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
49140 error     at FSReqWrap.oncomplete (fs.js:82:15)
49140 error
49140 error Error: EPERM: operation not permitted, rename '/home/wdd/share/mynps-corporate-client/node_modules/.staging/iconv-lite-94545a9f' -> '/home/wdd/share/mynps-corporate-client/node_modules/iconv-lite'
49140 error     at Error (native)
49140 error  { [Error: EPERM: operation not permitted, rename '/home/wdd/share/mynps-corporate-client/node_modules/.staging/iconv-lite-94545a9f' -> '/home/wdd/share/mynps-corporate-client/node_modules/iconv-lite'] parent: 'mynps-corporate' }
49141 error Please try running this command again as root/Administrator.
49142 verbose exit [ -1, true ]

When I searched online, I get to know the problem is with the symlinks. Symlinks are disabled by default on shared folders, so the following also fails:

ln: failed to create hard link ‘ln-server.js’ => ‘server.js’: Operation not permitted

I have tried:

  • sudo on guest
  • 'Run as Administrator' virtual box on host.
  • VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
  • Updated User Security Policy and allowed create symbolic links to 'Everyone'
  • Allowed all the privileges to everyone on security settings of the project folder properties in host machine.

I have already used the following links:

Update (2016-04-21): For now I have made a work around. I do an npm install in a directory that is not shared, and then moved the node_modules directory to the shared directory, and there is no problem. As it we do not install modules so frequently, it is fine. But yet, it would be great if one can point out a real solution for this.

Community
  • 1
  • 1
Musa Haidari
  • 2,109
  • 5
  • 30
  • 53

2 Answers2

3

The easiest way to deal with node_modules issues in a VM from a shared Windows project folder is to bind mount node_modules from another location in the Linux filesystem, but be sure to mount it after the virtualbox shared filesystem is mounted.

mkdir -p /home/wdd/node_modules /home/wdd/share/mynps-corporate-client/node_modules

sudo mount --bind /home/wdd/node_modules /home/wdd/share/mynps-corporate-client/node_modules

You will not see the contents of node_modules outside of the VM, but you will not have any more issues with symbolic links or path lengths.

Victor Roetman
  • 2,216
  • 2
  • 19
  • 14
0

Accepted solution did not work for me. I ended up running npm install on Windows rather than Linux. This might be a problem for certain packages however.

I have found one more solution that I haven't tried yet. You could maybe skip creating symlinks if it's only problem with them.

npm install --no-bin-links

See more here:

Samuel
  • 2,430
  • 5
  • 31
  • 41