yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.42k stars 2.72k forks source link

[BUG] Windows and `yarn link` #3343

Open flamusdiu opened 7 years ago

flamusdiu commented 7 years ago

Do you want to request a feature or report a bug? bug

What is the current behavior? Running yarn link fails on Windows due to permissions by default.

C:\Users\{user}\Documents\angular\micro-blog\bin\kae>yarn link --verbose
yarn link v0.23.4
verbose 0.329 current time: 2017-05-07T10:05:58.266Z
verbose 0.352 Error: EPERM: operation not permitted, symlink 'C:\Users\{user}\AppData\Local\Yarn\config\link\kae\kae.js' -> 'C:\Program Files\nodejs\kae'
error An unexpected error occurred: "EPERM: operation not permitted, symlink 'C:\\Users\\{user}\\AppData\\Local\\Yarn\\config\\link\\kae\\kae.js' -> 'C:\\Program Files\\nodejs\\kae'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\{user}\\Documents\\angular\\micro-blog\\bin\\kae\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/link for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.

yarn link from linking package.

What is the expected behavior? It should create the link inside C:\Users\{yarn}\AppData\Local\Yarn\.bin or another location. This was added from #1585. However, as pointed out in #1183. That directory does exists by default for some reason. So trying to link would surely fail.

Please mention your node.js, yarn and operating system version. Windows 10 x64 NPM 4.3.0 NodeJs 7.7.2 Yarn 0.23.4

Daniel15 commented 7 years ago

Are you on the latest Windows update (creators update)? The ability for non-elevated processes to create symlink was only added in that update.

flamusdiu commented 7 years ago

Umm, probably. I was looking around but this computer is using a Win 10 Ed license. I am not seeing a build number anywhere. Still, it should fall back to the User profile location.

bestander commented 7 years ago

Probably this is because symlinks were not enabled on the computer, it requires and Admin access to enable development mode in windows and then symlinks should be available to non root users

Zomis commented 7 years ago

Before trying to enable development mode, I can recommend to simply trying to run it as administrator, worked for me. Development mode might already be enabled.

earonesty commented 4 years ago

Running as administrator gets me: ``` error An unexpected error occurred: "ENOENT: no such file or directory, scandir 'C:\Users\erik\AppData\Local\Yarn\Data\link\CryptVFS-Message'".