`npm prune --production` issue
See original GitHub issueCurrent Behavior
Currently the package setup is like this:
├── package-a
├── package-b
└── package-core
both package-a and package-b depends on package-core (which is also an unpublished package).
We did run npm prune --production
per each package, otherwise the zip file is too big for lambda. But it ended up deleting the local dependency (package-core).
Expected Behavior
I wonder what would be the best way to use npm prune --production
.
NOTE, I could not run npm install --production
(as that local dependency package-core
is managed thru lerna).
Possible Solution
Steps to Reproduce (for bugs)
- lerna bootstrap
- lerna exec – npm run build (rough command)
- lerna exec – npm prune --production (rough command)
lerna.json
{
"lerna": "3.16.1",
"version": "independent",
"packages": [
"packages/*"
],
"npmClient": "npm",
"npmClientArgs": [
"--no-lockfile"
],
"useWorkspaces": false
}
Context
I am trying to shrink the package size with one local, unpublished, private dependency.
But when I run npm prune --production
per package, the local dependency is gone.
Your Environment
Executable | Version |
---|---|
lerna --version |
3.16.1 |
npm --version |
6.4.1 |
yarn --version |
VERSION |
node --version |
v8.16.0 |
OS | Version |
---|---|
macOS Mojave | 10.14.5 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
npm-prune
Description. This command removes "extraneous" packages. If a package name is provided, then only packages matching one of the supplied names are removed....
Read more >[BUG] npm prune --production does not remove hoisted prod ...
npm prune --production does not prune node_modules installed in workspace package folders. It appears to only modify the workspace root ...
Read more >Why doesn't `npm prune` remove folders from node_modules?
According to documentation. If the --production flag is specified, this command will remove the packages specified in your devDependencies .
Read more >1530833 – npm prune --production fails - Red Hat Bugzilla
Description of problem: `npm prune --production` fails when devDependencies contain bins Version-Release number of selected component (if applicable): ...
Read more >Uninstalling dev dependencies with npm by Josh Sherman
While looking into some deployment issues recently, ... Removes the devDependencies npm prune --production # Does the rest of the stuff in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When you had previously already installed your dependencies you can go for a
lerna clean
before doinglerna bootstrap -- --production
- otherwise the extraneous dependencies will be kept.@chenrui333 Apologies to necropost, but in case you (or someone else) needs a potental solution.
npm prune --production --no-package-lock
works to not remove packages that are not in the package-lock, which would be any hoisted or local dependencies.However, the
--no-package-lock
option doesnt seem to be in the docs as a valid option fornpm prune
, so use it at your own risk.