sous-chefs/nodejs

NPM install doesn't run if package is already installed

Closed this issue · 8 comments

The install action is skipped due to the "not_if" clause in the provider. This makes it very difficult (impossible?) to upgrade packages just by using the install action, even with the --force option. The current workaround for me is to uninstall the package (which is skipped if it isn't installed) then install it.

Should we just remove the not_if installed clause? Or should there be a :force_install action?

You can upgrade a npm package by putting the version number you want.

In fact, what you want is an action upgrade who upgrade even if already installed :)

+1

I´ve got clients with npm 1.4 installed. There is no upgrade even if I put version 2.1.18 in my config to install from source.

I believe I am hitting this issue also. I have a fork that I point npm to of a package. The package is correctly installed via my fork and things are fine.

Now when my code has been merged into master I can eliminate the source line in my recipe and would expect that the next chef run would update my npm module. Instead I have the original fork still.

I will try to dig in and figure out if something is preventing it.

I believe for me this is the problem https://github.com/redguide/nodejs/blob/master/libraries%2Fnodejs_helper.rb#L33-37. So if I don't specify the version, it will still fill version so this will evaluate to true every time.

I think I was actually running into a different problem which I fixed with #77

I fixed it by setting version: '*'

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

The auto_update option in the npm_package resource fixes this issue in its tests. #225