Do you want to request a feature or report a bug?
bug
What is the current behavior?
When having a yarn workspace, adding one of the packages to another and then executing yarn install throws this error:
Error: ENOENT: no such file or directory, copyfile '/Users/tim/Library/Caches/Yarn/v1/npm-jsonfile-4.0.0-8771aae0799b64076b76640fca058f9c10e33ecb/CHANGELOG.md' -> '/Users/tim/code/prisma-deployment-test/cli/node_modules/prisma-yml/node_modules/jsonfile/CHANGELOG.md'
If the current behavior is a bug, please provide the steps to reproduce.
git clone [email protected]:graphcool/prisma.git
git checkout 97b85c6d7ac0f8eabbb481b4e9b81f99d67d8f99
cd cli/packages/prisma-yml
yarn install
yarn build
cd ../prisma-cli-engine/
yarn add -E prisma-yml
yarn install #BOOM
What is the expected behavior?
Execute yarn install without throwing an error.
Please mention your node.js, yarn and operating system version.
[email protected]
[email protected]
macOS [email protected]
That's a strange one. Even after it errors, I can stat both the "from" and "to" files reported in the error, and they both exist 😕
I was having a similar issue but worked around it by removing node_modules. Guess that's not the most friendly solution here, though.
When I just tried to reproduce the bug, I got there error already during the "yarn add -E prisma-yml" step. The "no such file or directory" message was appropriate here since the target directory cli/node_modules/prisma-yml/node_modules/jsonfile really didn't exist.
rm -rf node_modules && yarn cache clean && yarn install solves most such problems.
For what it's worth, I wasn't able to cure with the steps Markus suggests. I even tried reinstalling yarn and manually deleting the yarn cache using rm -fr ~/Library/Caches/Yarn.
I did find a partial solution. I'm posting here in hopes it sheds light on what the underlying issue might be. Bullet 4 below shows how I fixed it.
My situation:
yarn add ssh+git://[email protected]/me/myprivatemodule.git. To be specific, myprivatemodule depends on mathjs, and yarn install was stopping with:error An unexpected error occurred: "https://registry.yarnpkg.com/mathjs/-/mathjs-5.0.2.tgz: ENOENT: no such file or directory, open '/Users/aneil/Library/Caches/Yarn/v1/npm-mathjs-5.0.2-ed23dcfb40e886697447bcfe43e5dc5d92dd8eb0/docs/reference/functions/permutations.md'".
npm-mathjs-3.20.2-3218aebde7de8cb5627c8fe3a1a216bf399ba91d/
npm-mathjs-5.0.2-ed23dcfb40e886697447bcfe43e5dc5d92dd8eb0/
And... the 5.0.2 directory was empty, which is why I was seeing the error.
It's worth noting that I was attempting to yarn install a freshly cloned repo on a new machine
Running yarn add ssh+git://[email protected]/me/myprivatemodule.git fixed the problem
I can reproduce the error with
rm -fr node_modules && yarn cache clean && yarn install
So, although I can continue development, I suspect my CI is borked.
Update:
I see why I have two copies of the offending module - another dependency of my private module depends on the 3.20.2 version of mathjs. However, making myprivatemodule use the same version of mathjs doesn't solve the issue.
I had this today, and had to rm -rf my yarn cache dir, the one used when running yarn in ~/.cache/yarn and the one in /usr/local/share/.cache/yarn used when running sudo yarn. This is in Ubuntu 18 on Windows 10.
❯ node -v
v10.15.0
❯ npm -v
6.6.0
❯ yarn -v
1.13.0
This is still an issue, even in 1.14
Arguments:
/home/jeff/n/bin/node /usr/share/yarn/bin/yarn.js install
PATH:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/jkono/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/jkono/AppData/Local/hyper/app-2.1.2/resources/bin:/mnt/c/Users/jkono/AppData/Local/Programs/Microsoft VS Code/bin:/home/jeff/n/bin
Yarn version:
1.14.0
Node version:
10.15.1
Platform:
linux x64
Trace:
Error: ENOENT: no such file or directory, scandir '/mnt/c/Users/jkono/dev/PROJECT/node_modules/@storybook/addon-links/src'
still errs after rm -rf node_modules and yarn cache clean.
Yarn version:
1.13.0
Node version:
11.10.0
Platform:
linux x64 (WSL)
Trace:
Error: ENOENT: no such file or directory, lstat '/home/h/.cache/yarn/v4/npm-enhanced-resolve-4.1.0-41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f/node_modules/enhanced-resolve/lib/AliasPlugin.js'
fix with yarn global add yarn to re-install yarn. (someone tells me what happens?)
I found success by reinstalling yarn w/brew.
Had the same problem upgrading to yarn 1.15.2. removing node modules and cleaning cache did the trick.
still errs after
rm -rf node_modulesandyarn cache clean.Yarn version:
1.13.0Node version:
11.10.0Platform:
linux x64 (WSL)Trace:
Error: ENOENT: no such file or directory, lstat '/home/h/.cache/yarn/v4/npm-enhanced-resolve-4.1.0-41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f/node_modules/enhanced-resolve/lib/AliasPlugin.js'fix with
yarn global add yarnto re-install yarn. (someone tells me what happens?)
This worked for me
For those hitting this problem from inside WSL on Windows, this fixed it for me:
node_modulesyarn install inside the project _from within Windows cmd/powershell_Installation succeeded, and switching back to an Ubuntu terminal (in WSL (inside VSCode)) I could yarn start without issue.
This may not have anything to do with the issue here, but in case it helps, I have run across this issue when trying to copy files in between different volumes (especially NAS volumes) using the native fs routines.
Most helpful comment
rm -rf node_modules && yarn cache clean && yarn installsolves most such problems.