I'm looking for using yarn and npm together in my project and if I find yarn useful for my particular case, I could move my project to use yarn only.
Nevertheless, I'm getting the following error with $yarn import:
local:project_middleware jgil$ yarn import
Internal Error: project-middleware@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
at J.getCandidates (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:325115)
at i.getCandidates (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:314232)
at /Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:335605
at Array.map (<anonymous>)
at Ae.resolveEverything (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:335321)
at async Ae.applyLightResolution (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:357937)
at async Ae.restoreInstallState (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:357667)
at async Ke.execute (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:98394)
at async Ke.validateAndExecute (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:626801)
at async j.run (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:17:3854)
I have already run $yarn set version berry and tried out again and again with different combinations of removing the node_modules directory, running npm install, etc. and nothing gets to make it work... no idea of what's missing.
Could it be a problem with either the version of Node.js or any other component I'm using?
The problem in here seems to be an existing yarn.lock file inside of one of the workspaces. Deleting it solves the problem.
Example: 3 workspaces: 2 create-react-app (app, home) and one shared component: (components)

Inside the component folder a lingering yarn.lock file exists. Remove it.

Also check that:
"private": true in each of their package.json (same level as name, private, source)."workspaces" key in the main package.jsonyarn workspaces myworkspace myworkspace matches the name of your workspace in its package.json. In my case, the name of the workspace inside the components folder is called @schon/components, so I need to address it as yarn worksapces @schon/components instead.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With