question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`lerna` does not create links on local referenced dependencies in package.json

See original GitHub issue

I have some projects and I changed its dependencies by using file references in package.json: por example:

	"dependencies": {
		"@gcw/model": "file:../gcw-model",
		"angular-animate": "1.7.9"
       }

npm install (version 6.13.7) creates a link in node_modules linking to the folder. but lerna bootstrap (even lerna link --force-local) does not create it.

Expected Behavior

I expect that every time I execute lerna bootstrap, I have all my projects with links between them created.

Current Behavior

If I run npm install on every project. NPM does create the links, and Lerna does not delete it, which is ok, but if I delete the links, lerna does not create them either.

Steps to Reproduce (for bugs)

  1. Create a lerna style project with 2 or more projects
  2. Declare the dependency of one project to another referencing it using file:../my-dep-proj
  3. Ensure that you don’t have already the link created inside node_modules
  4. Run lerna boostrap, and see it doing nothing about the link.
{
  "packages": [
    "packages/*"
  ],
  "version": "0.20.0"
}

Your Environment

Executable Version
lerna --version 3.20.2
npm --version 6.13.7
node --version v13.10.1
OS Version
Windows 10 Pro 1909 18363.657

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:6

github_iconTop GitHub Comments

1reaction
jcebcommented, Aug 6, 2020

I was able to reproduce the behavior with npm 6.14.6, yarn 1.22.4, lerna 3.22.1, and node v12.18.3. When I referenced the local packages with a version number instead of the file:.. link lerna bootstrap created the links.

0reactions
JamesHenrycommented, Nov 29, 2022

Hi Folks 👋

Please take a look at our published roadmap for Lerna v7 here: https://github.com/lerna/lerna/discussions/3410

One of the key items covered at length on there (please do read it for full context) is that now that we find ourselves in late 2022, it no longer makes sense for lerna to supplement package management concerns (such as installation, boostrapping, linking etc) which are covered reliably for monorepo workspaces by the three main package managers: npm, yarn and pnpm. lerna bootstrap et al were developed in completely different era of the JavaScript ecosystem.

If you have any specific concerns please do join in on that discussion, and provide as much context as possible.

Many thanks 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna bootstrap does not link local dependencies · Issue #2352
I have configured two modules in a mono repo to use lerna with a local dependency. I expected that $ lerna bootstrap $...
Read more >
Lerna bootstrap does not link local dependencies?
Another work-around is to manually "hoist" your intra-package dependencies by adding them to the root package.json per lerna issue #2352.
Read more >
Managing Monorepo using Lerna and Yarn workspaces
First, you have to set the private and workspaces fields in package.json in the root directory. The private field should be true ,...
Read more >
Setting up a monorepo with Lerna for a TypeScript project
lerna bootstrap installs and links all dependencies, both local and remote. When using lerna add , the lerna bootstrap command is called ...
Read more >
How To Manage Monorepos With Lerna - DigitalOcean
Lerna is as a tool for managing JavaScript projects with multiple ... lerna info Creating package.json lerna info Creating lerna.json lerna ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found