Skip to content
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

Run npm prune before install. #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lijunle
Copy link

@lijunle lijunle commented Nov 28, 2015

  • npm prune will clean up useless packages under node_modules.
  • Otherwise, the useless packages may affect normal runtime by accident.

@davidebbo
Copy link
Member

Does it need --production to match the install command?

@lijunle
Copy link
Author

lijunle commented Dec 2, 2015

Updated.

- [`npm prune`](https://docs.npmjs.com/cli/prune) will clean up useless packages under `node_modules`.
- Otherwise, the useless packages may affect normal runtime by accident.
@davidebbo
Copy link
Member

So I’m playing with it with ghost (https://github.com/felixrieseberg/Ghost-Azure), and it’s not behaving as I would expect.

  • I run npm install --production and it gets to a stable state. i.e. if I run the same command again, nothing is installed
  • But if I then run npm prune --production, it removes 3 packages:
  • Then running the same prune again does nothing
  • Then running the same install again brings back those packages

I would have expected ‘prune’ to be a no-op right after a clean install. The problem is that based on what I observed, it’s going to keep uninstalling/installing things on every Kudu deployment, no matter how small. This could cause big perf regressions on incremental deployments.

Am I misunderstanding how prune works?

@lijunle
Copy link
Author

lijunle commented Dec 8, 2015

The issue you mentioned seems like a bug for npm itself.

I think yes to expect 'prune' to be a no-op right after a clean install. However, there is no clean install on kudu deployment.

My story: I am developing a website and deploy it to Azure. Its dependencies changes day to day. And, in some case, there is a necessary to do a clean install, for example, upgrade Babel from 5 to 6. Kudu does not provide a way to do clean install, prune seems a better way to solve this problem.

@davidebbo
Copy link
Member

Yep, I understand your situation, and the idea of pruning absolutely makes sense. However, I'm concerned about potential regressions (perf and maybe functional) if we don't have a clear understanding of exactly what the command does. And based on the one test I tried, it does weird things and would almost certainly cause perf regressions, constantly deleting and then reinstalling packages even where there are no changes at all.

Let's try to get a better understanding of why it's doing that, and potentially open an npm bug accordingly.

Note that in the meantime, you can use a custom deployment script to have the prune command.

So again, I like the change, but I want to be careful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants