-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hoisting seems broken with npm5 #856
Comments
Yeah it's definetely not handled yet (nothing on npm 5 is supported since we haven't tested) |
This is not surprising, but definitely needs to be addressed. Hopefully we can delegate most/all of the bootstrapping logic to |
might be worth making a note of somewhere, node8 is coming out today and ships with (or soon will ship with npm5) Don't want ya'll overrun by folks with the same issue :) |
#851 is another |
Lerna doesn't really support npm@5 yet, see lerna/lerna#856
Workaround to force npm 4.6 despite a global npm 5, at least when running
|
This works well on macOS and Linux, does not work well on Windows as the
We only noticed that via our AppVeyor setup. |
Notably, if you "manually" hoist all the managed dependencies into the root (thus ensuring |
@evocateur what are you calling "hoisting manually"? |
All dependencies in ./packages/*/package.json are literally added to ./package.json
Thus, when bootstrapping, everything already exists in the root and only symlinking is necessary.
… On Jun 10, 2017, at 15:09, Maxime Thirouin ***@***.***> wrote:
@evocateur what are you calling "hoisting manually"?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
What would be an ideal way of combining all the dependencies of the subpackages to add to the main package? |
@rgbkrk, something like this should work (adapted from a JuypterLab script): var path = require('path');
var glob = require('glob');
/**
* Handle an individual package on the path - get its dependencies.
*/
function handlePackage(packagePath, data) {
// Read in the package.json.
var packagePath = path.join(packagePath, 'package.json');
try {
var package = require(packagePath);
} catch (e) {
console.log('Skipping package ' + packagePath);
return;
}
var deps = package.dependencies || [];
for (let dep in deps) {
data.dependencies[dep] = deps[dep];
}
}
var data = require('./package.json');
// Handle all of the packages.
var basePath = path.resolve('.');
var files = glob.sync(path.join(basePath, 'packages/*'));
for (var j = 0; j < files.length; j++) {
handlePackage(files[j], data);
}
console.log(JSON.stringify(data.dependencies, null, 2)); |
Follow up: I just tried the above for JupyterLab here, and not all of the packages are ending up in the top level |
* Use node 6 instead of node 8 / npm 5 because of lerna/lerna#856 * Use urijs instead of the node 7+ URI package. * Don't ask lerna to hoist all dependencies. This makes our docker images smaller because we don't need to put the union of all dependencies in every image. tsmonad still needs to be hoisted to work around microsoft/TypeScript#6496. * Remove yarn.lock and package-lock.json files.
package-lock.json can be disabled using |
Confirmed that |
Anyone figured how to set that locally? |
It seems like you could add a package-lock = false in it? Can't test it atm but seems plausible. |
That should work, |
It does work, though you need a |
@jquense @evocateur is there a minimally reproduce-able example we can provide npm so they can debug this issue? |
I just use relative |
Or Should we switch to recommending that by default? I'm biased but think so. |
@tivac Since lerna itself has no problem at all using |
@tivac Is |
No, it isn't. Again, it's more than likely a symptom of misbehaving dependencies, not Windows platform-ness. Relative |
Yup, sorry everybody, I totally misunderstood the purpose of I ran But now what? Should |
Yep! The whole tree becomes serialized in the |
I was running into some trouble with that workflow last night but think I finally got things cleaned up and functioning more cleanly! Thanks for your patience as I stumbled through this process. |
@evocateur please excuse the follow-ons; I am hoping you can clarify your comment above regarding BTW it would be great to update the lerna doc to include a description of this golden path free of bootstrap. |
Yeah, that PR eventually went back to I agree I really need to get around to a blog post or something... |
@evocateur is |
Yeah, sometimes I forget the CLI help isn't automatically shown in the README. And in this case, could definitely use more context. Along with that Lerna 3.0 blog post I've been meaning to write for a few months now...
(cut off repetitive global options) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
hi all, I don't see any issues with Lerna hoisting on |
* Use node 6 instead of node 8 / npm 5 because of lerna/lerna#856 * Use urijs instead of the node 7+ URI package. * Don't ask lerna to hoist all dependencies. This makes our docker images smaller because we don't need to put the union of all dependencies in every image. tsmonad still needs to be hoisted to work around microsoft/TypeScript#6496. * Remove yarn.lock and package-lock.json files.
* Use node 6 instead of node 8 / npm 5 because of lerna/lerna#856 * Use urijs instead of the node 7+ URI package. * Don't ask lerna to hoist all dependencies. This makes our docker images smaller because we don't need to put the union of all dependencies in every image. tsmonad still needs to be hoisted to work around microsoft/TypeScript#6496. * Remove yarn.lock and package-lock.json files.
* Use node 6 instead of node 8 / npm 5 because of lerna/lerna#856 * Use urijs instead of the node 7+ URI package. * Don't ask lerna to hoist all dependencies. This makes our docker images smaller because we don't need to put the union of all dependencies in every image. tsmonad still needs to be hoisted to work around microsoft/TypeScript#6496. * Remove yarn.lock and package-lock.json files.
Hi Folks 👋 Please take a look at our published roadmap for Lerna v7 here: #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. If you have any specific concerns please do join in on that discussion, and provide as much context as possible. Many thanks 🙏 |
Expected Behavior
lerna bootstrap --hoist
should hoist dependencies when usingnpm@5
Current Behavior
The correct package.json is generated in the root directory but none of the hoisted deps are installed when a
package-lock.json
is present....which as far as I can tell (thanks npm docs!) can't be toggled off.lerna.json
Your Environment
lerna --version
npm --version
The text was updated successfully, but these errors were encountered: