Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using npm on windows host will cause symlink errors #611

Closed
jonnywilliamson opened this issue Jul 13, 2017 · 5 comments

Comments

@jonnywilliamson
Copy link
Contributor

commented Jul 13, 2017

Please note that the Homestead issue tracker is reserved for bug reports and enhancements. We are not always able to debug Vagrant, Provider or Operating System issues but will do our best to help. Thank you!

Versions

  • Vagrant: Run vagrant -v to show the version.
    Vagrant 1.9.2

  • Provider: Virtualbox, VMWare or Parallels and it's version.
    VirtualBox

  • Homestead: Run homestead --version to show the version.
    5.3.2

Host operating system

This is the operating system that you run locally.

Windows 10 64 bit.

Homestead.yaml

---
name: homestead7
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox


authorize: /Users/Jonathan/Dropbox/Documents/SSH-Keys/Homestead/homestead.pub

keys:
    - /Users/Jonathan/<snip>/private.key

folders:
    - map: /Code
      to: /home/vagrant/Code

sites:
    - map: new.app
      to: /home/vagrant/Code/new.app/public


databases:
    - homestead

ports:
     - send: 80
       to: 80
     - send: 443
       to: 443

Expected behavior

Before you begin

Make sure you have started vagrant on windows using a normal user. ie, you have NOT selected to run as administrator

My npm verison is 5.0.3 (but has existed in all versions)

  1. Create a new folder like /code/npmBug

  2. Create a package.json file in it with the following

{
  "devDependencies": {
    "babel-cli": "^6.24.1"
  }
}
  1. Save it then run npm install

What should have happened?

21:43:08 ✔ vagrant@homestead $ npm install

> fsevents@1.1.2 install /home/vagrant/Code/npmbug/node_modules/fsevents
> node install

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN npmbug No description
npm WARN npmbug No repository field.
npm WARN npmbug No license field.

added 182 packages in 35.105s

Actual behavior

What actually happened?

[~/Code/npmbug]
22:01:19 ✔ vagrant@homestead $ npm install
npm WARN npmbug No description
npm WARN npmbug No repository field.
npm WARN npmbug No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pre-gyp@0.6.36 (node_modules/fsevents/node_modules/node-pre-gyp):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/vagrant/Code/npmbug/node_modules/fsevents/node_modules/node-pre-gyp' -> '/home/vagrant/Code/npmbug/node_modules/fsevents/node_modules/.node-pre-gyp.DELETE'

npm ERR! path ../babel-cli/bin/babel.js
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! syscall symlink
npm ERR! EPROTO: protocol error, symlink '../babel-cli/bin/babel.js' -> '/home/vagrant/Code/npmbug/node_modules/.bin/babel'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2017-07-13T22_02_13_998Z-debug.log

However:

If we start Vagrant as a windows admin account (eg open command prompt by right clicking on cmd icon and selecting Run as administrator, then start vagrant/homestead as normal)

None of these issues then appear. All npm commands work and symlinks are created during the install process successfully.

I did attempt to use this PR: #609 and ran vagrant as a normal user. However when running the command npm install it again produced a symlink error and installation was a failure.

Because of this, I'm not sure if there's any real fix for windows hosts.

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

Basically there no need for me to write anything else as it's all covered here in the issue below!

npm/npm#7308 but more specifically, everything after:
npm/npm#7308 (comment)

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jul 13, 2017

Thanks for taking the time to write this up. As I expected this is caused by not running the console application as administrator (therefore running vagrant as Administrator). There isn't anything we can do to fix this for windows users (and not make a change that would affect all platforms as the previous PR showed).

Sounds like the best advice is to run Vagrant as an administrator on Windows, or use the Linux subsystem to create your projects instead of doing it in Homestead.

@greenbuks

This comment has been minimized.

Copy link

commented Feb 17, 2018

On Windows use Babun

@s3w47m88

This comment has been minimized.

Copy link

commented Jun 24, 2019

npm install --no-bin-links as a workaround resolved the issue for me.

@juangiordana

This comment has been minimized.

Copy link

commented Jun 24, 2019

The problem is that npm install is trying to create symlinks on an NTFS file system, which doesn't have that feature. So with the --no-bin-links option it will copy all references to the same node projects as needed.

@orrd

This comment has been minimized.

Copy link

commented Aug 4, 2019

By the way, if you already ran npm install, you have to delete the node_modules directory (rm -rf node_modules) before running npm install --no-bin-links or otherwise it'll still fail at the same place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.