kentcdodds/testing-workshop

Windows: Symlink requires elevated prompt

stefanivic opened this issue · 5 comments

Environment info:

  • Operating system : Windows 10 Pro, Version 1709, OS Build : 16299.192.
  • Windows insiders : No. Running on stable builds.
  • node version (node --version): v8.9.4
  • npm version (npm --version): v5.6.0
  • yarn version (yarn --version): v1.3.2

Problem description:

Reference: #49

Running the setup script will fail because symlink requires elevated permission on Windows.

C:\Users\night\Development\testing-workshop>npm run setup --silent
🎉  Congrats! Your system is setup properly
You should be good to install and run things.
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EPERM: operation not permitted, symlink 'C:\Users\night\Development\testing-workshop\shared' -> 'C:\Users\night\Development\testing-workshop\client\other\shared'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at symlinkDir (C:\Users\night\Development\testing-workshop\scripts\ensure-symlinks.js:20:8)
    at Object.<anonymous> (C:\Users\night\Development\testing-workshop\scripts\ensure-symlinks.js:9:1)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)

Suggested solution:

This is just a heads up as this could be solved by running the prompt as an Administrator.
Maybe we can add this to the Troubleshoot/Readme, or check if the user is running in elevated mode before starting the script.

I can verify this, too. Running in an elevated prompt allowed the symlink step to complete. Once that is done, npm run dev seems to run fine under a regular prompt.

Awesome feedback, thanks folks!

I may try to figure out a way to do this so you don't need a symlink locally. That would probably simplify things a bit :)

If you could try this out again, it shouldn't require you use an elevated prompt anymore :) Thanks again!

Looks like that did it. Setup completed without error in a regular command prompt.