1

I have a package (let's call it create-foo) that my users are supposed to always run using npm init foo. The problem is that if the user has previously run the command it never updates it. I know that the user can run npm init foo@latest but is there a way to change the default behavior for a package? i.e. is there a way for a package to specify that it wants to always prefer the remote version to be checked?

ascorbic
  • 36
  • 3
  • Maybe you are talking about npm install and not npm init – Yuriy Vorobyov Dec 16 '20 at 11:52
  • 2
    No, [npm init](https://docs.npmjs.com/cli/v6/commands/npm-init) – ascorbic Dec 16 '20 at 13:48
  • 1
    Have you found a way to do it? I am having a similar issue with `npx`. The npm team very unfortunatelly doesn't seem to want the "use latest" behaviour as default (or an option for users and devs to set it). https://github.com/npm/cli/issues/2329#issuecomment-826016790 I am thinking of creating another package, and my pkg1 will have a call to npx pkg2@latest. Ugly workaround, but probably will work. Or, at each start, it will check if the current version is the latest one. Else, will delete the current cache and call itself. – Henrique Bruno Apr 25 '21 at 02:49
  • No, I never did find a solution. Your ugly workarounds sound like the best hope. – ascorbic Apr 26 '21 at 06:24

0 Answers0