Suggested development flow?
See original GitHub issueI’m developing packages in tandem that rely on each other, and I keep getting 404s when trying to install a dependency that is contained in my repo.
What is the suggested flow for working on these packages in tandem with other teammates?
imagine packages structure like: /team-components /team-app-generator
I ran lerna bootstrap
then tried npm install team-components
inside team-app-generator but keep getting 404s because it’s trying to hit NPM. I made sure the version numbers match, so I don’t think this is what’s happening. I’m not sure if I’m doing something out of order or if there’s an issue with Lerna.
Edit: so it looks like it does actually look to team-components
when I do an import, but it’s not in the package.json. For packages that will never be published to NPM and only used within this repo, do I not need to make sure they’re in the package.json?
Edit2: removing the packages from the package.json caused issues. Now I’m a bit confused. After running lerna bootstrap, I can npm install some packages (it installs with an @security tag, is this how Lerna connects to my local package? or is this because these were accidentally published to NPM and then removed, so NPM installs with the security tag?), but am still getting a 404 for the team-components package, which was setup the same way as the other packages that are installing.
Issue Analytics
- State:
- Created 6 years ago
- Comments:41 (15 by maintainers)
If you’re never going to publish a given package, make sure you set
"private": true
in its package.json. It will then be available to link during bootstrap, but in this case (for public packages), you really shouldn’t be depending on a private package as that fundamentally breaks any consumer.If you’re not publishing any of these packages, I would strongly advise against using lerna. Just use a single package.json and a reasonable directory structure.
When using lerna, you do not (generally) run
npm install
anywhere except the root of the repo (whereverlerna.json
and thepackage.json
sibling that holds the commondevDependencies
+ test/lint scripts lives).lerna bootstrap
is the way you install things in the managed packages. The association of “sibling” packages (subdirectories of./packages
, by default) is matched by package name (not strictly the directory name, but whatever is in thename
property of./packages/${package_name}/package.json
) andsemver
-satisfying version range.Given this structure:
With these
package.json
s underpackages
:The following things should happen during
lerna bootstrap
:./packages/package-1
is symlinked into./packages/package-2/node_modules/@my-scope/package-1
foo-bar-package-2@0.1.5
is not symlinked into./packages/package-1/node_modules/...
, but instead installed from npm (because the semver range does not satisfy the current repo version of@my-scope/package-1
, which is 1.0.3)Does that make sense?
I tried to use Lerna with not-yet published packages and it didn’t work. I get the same error with and without
"private": true
.This is my package:
And this is some other package requiring it:
When I try to use
lerna bootstrap
I get (I’ve gotlerna@v2.4.0
):I need to be able to work with packages which are not yet published for instance when we’re starting their development. Right now I need to publish their
0.0.1
version right after creating the package to satisfy Lerna. This is problematic because such a package isn’t functional yet and might actually never be (if this is some research, fo instance).