ddev: yarn cacheFolder configuration breaks running yarn operations outside of ddev
Is there an existing issue for this?
- I have searched the existing issues
Run a Diagnostic and Paste Link Here
ddev 1.21.1 macOs 12.6 yarn stable (3.x)
Expected Behavior
I have a project where I use yarn as “utility tool launcher” i.e. use it to start the project (includeing ddev), run storybook server import/export databases from remote server etcpp.
e.g. I use yarn start
to start ddev and start webpack dev server
Or I use yarn run clearcache
to execute the command on the ddev web container to clear the typo3 cache
Then I call yarn add somepackage
or other yarn package operations that succeed.
Actual Behavior
After updating to ddev 1.20.1 v1.21.1 the behaviour changed.
When I run ddev start
, ddev adds a cacheFolder configuration to the .yarmrc.yml file pointing to a path that only exists in the docker container, but not on on the host (cacheFolder: /mnt/ddev-global-cache/yarn/my_project).
Subsequent yarn calls which operate on yarn packages (yarn
, yarn add x
, etc) fail with
Internal Error: ENOENT: no such file or directory, mkdir ‘/mnt’
as the /mnt directory doesn’t exist on my mac.
Steps To Reproduce
➜ yarn set version stable ➤ YN0000: Retrieving https://repo.yarnpkg.com/3.2.3/packages/yarnpkg-cli/bin/yarn.js ➤ YN0000: Saving the new release in .yarn/releases/yarn-3.2.3.cjs ➤ YN0000: Done in 0s 232ms
➜ yarn init { name: ‘foo’, packageManager: ‘yarn@3.2.3’ }
➜ yarn add webpack … ➤ YN0000: Done with warnings in 1s 748ms
➜ ddev config Creating a new ddev project config in the current directory (/tmp/foo) … Configuration complete. You may now run ‘ddev start’.
➜ cat .yarnrc.yml yarnPath: .yarn/releases/yarn-3.2.3.cjs
➜ ddev start Starting foo… …Project can be reached at https://foo.ddev.site https://127.0.0.1:53727
➜ cat .yarnrc.yml cacheFolder: /mnt/ddev-global-cache/yarn/foo-web
yarnPath: .yarn/releases/yarn-3.2.3.cjs
➜ yarn remove webpack Internal Error: ENOENT: no such file or directory, mkdir ‘/mnt’ Error: ENOENT: no such file or directory, mkdir ‘/mnt’
Anything else?
I really just need a way to block ddev from writing into the .yarnrc.yml file or change the path to something in .ddev?
It’s more of a nuisance currently as the change is easily undone and there probably are some workarounds like creating a /mnt dir or a post-start hook which removes the line again or something.
Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (13 by maintainers)
Commits related to this issue
- Use env var for yarn cache dir, fixes #4215 — committed to rfay/ddev by rfay 2 years ago
You are awesome, thanks!