You should be able to accomplish this with npm link
. Although I have not tried this using a local dependency that is not published on npm.
Directory tree
foo/
packages/
core/
package.json
errors/
package.json
bar/
package.json
foo/packages/core/package.json
{
...
dependencies: {
"@foo/errors": "*"
}
}
bar/package.json
{
...
dependencies: {
"@foo/core": "../foo/packages/core"
}
}
Run the following commands
cd foo
npx lerna clean
npx lerna bootstrap --hoist
npm run build # command to build your projects
cd packages/core
npm link
cd ../../../bar
npm i
npm link @foo/core
Removing package-lock.json files usually does more harm then good! And about not being able to find @foo/errors
, if you ran npm bootstrap, @foo/core
should be symlinked to @foo/errors
. One possibility could be that your lerna scripts are using npm while you where running install/link with yarn.