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.

Suggested development flow?

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:41 (15 by maintainers)

github_iconTop GitHub Comments

6reactions
evocateurcommented, Jun 13, 2017

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 (wherever lerna.json and the package.json sibling that holds the common devDependencies + 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 the name property of ./packages/${package_name}/package.json) and semver-satisfying version range.

Given this structure:

.
├── lerna.json
├── package.json
└── packages
    ├── package-1
    │   └── package.json
    └── package-2
        └── package.json

With these package.jsons under packages:

{
  "name": "@my-scope/package-1",
  "version": "1.0.3",
  "dependencies": {
    "foo-bar-package-2": "^0.1.5"
  }
}
{
  "name": "foo-bar-package-2",
  "version": "1.1.0",
  "dependencies": {
    "@my-scope/package-1": "^1.0.0"
  }
}

The following things should happen during lerna bootstrap:

  1. ./packages/package-1 is symlinked into ./packages/package-2/node_modules/@my-scope/package-1
  2. 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?

2reactions
Reinmarcommented, Dec 14, 2017

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:

{
  "name": "@ckeditor/ckeditor5-foo",
  "private": true,
  "version": "0.0.1"
}

And this is some other package requiring it:

{
  "name": "ckeditor5",
  "version": "1.0.0-alpha.2",
  "dependencies": {
    ...
    "@ckeditor/ckeditor5-foo": "*",
  }
}

When I try to use lerna bootstrap I get (I’ve got lerna@v2.4.0):

lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npm install
lerna ERR! npm ERR! code E404
lerna ERR! npm ERR! 404 Not found : @ckeditor/ckeditor5-foo
lerna ERR! npm ERR! 404
lerna ERR! npm ERR! 404  '@ckeditor/ckeditor5-foo' is not in the npm registry.
lerna ERR! npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
lerna ERR! npm ERR! 404
lerna ERR! npm ERR! 404 Note that you can also install from a
lerna ERR! npm ERR! 404 tarball, folder, http url, or git url.
lerna ERR!
lerna ERR! npm ERR! A complete log of this run can be found in:
lerna ERR! npm ERR!     /Users/p/.npm/_logs/2017-12-14T12_47_26_000Z-debug.log
lerna ERR!
lerna ERR!     at Promise.all.then.arr (/usr/local/lib/node_modules/lerna/node_modules/execa/index.js:236:11)
(node:78434) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: Command failed: npm install
npm ERR! code E404
npm ERR! 404 Not found : @ckeditor/ckeditor5-foo
npm ERR! 404
npm ERR! 404  '@ckeditor/ckeditor5-foo' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Product Development Flow - GitLab
Denotes a required aspect of the product development flow. ... When: When our confidence about the proposed problem or solution isn't high.
Read more >
Git Workflow | Atlassian Git Tutorial
A git feature branch is a temporary branch used for development or testing purposes. Learn about the best way to manage them using...
Read more >
Suggested development workflow for dialogues
Suggested development workflow for dialogues · Know your stages. At the least, have a development and production stage. · Use labeling or tagging....
Read more >
Build Learning into Your Employees' Workflow
Learning and development programs give employees the tools they need to successfully carry out their jobs and advance their careers.
Read more >
The ultimate guide to software development process: flow ...
Software development cycle is a complex process that involves a number of steps. Click to read about each step in more detail.
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