Moment-timezone: NPM install dependency

Created on 27 Sep 2014  ยท  4Comments  ยท  Source: moment/moment-timezone

Perhaps "moment" shall be specified as peerDependency for npm package?

environment

Most helpful comment

No thoughts on this? It's really weird to have 2 moment installed on my node_modules.
I have the direct dependency for moment and moment-timezone. But the last also has a dependency for moment, so what I have is this:

โ”œโ”€โ”€ [email protected] 
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”€ [email protected] 

Even with the same version, npm install the second dependency. Probably with PeerDependency would solve this problem.

All 4 comments

Hey @timrwood. Any comment on this? We're having issues with localization in our setup where we're using browserify to be able to use npm packages in the browser. The problem is that moment-timezone uses it's own instance of moment, so when we go ahead and set the locale of our instance of moment, then the instance managed by moment-timezone is (of course) not updated accordingly.

This leads third party dependencies that rely on moment to adhere to a different locale than the third party dependencies relying on moment-timezone. Not to mention that it is suboptimal to ave two instances of moment running right?

Thanks for maintaining this repo by the way :)

No thoughts on this? It's really weird to have 2 moment installed on my node_modules.
I have the direct dependency for moment and moment-timezone. But the last also has a dependency for moment, so what I have is this:

โ”œโ”€โ”€ [email protected] 
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”€ [email protected] 

Even with the same version, npm install the second dependency. Probably with PeerDependency would solve this problem.

@mj1856 Do you have any insights on this? I have the same problem as @nicolaidahl and I'm blocked since 3 days. The locale is loaded on the original moment and not the moment used in moment-timezone.

@gabrielalan
This worked for me:

  1. use specific version of moment without ^ before version number ("moment": "2.19.4" in your case)
  2. rm -rf your-project/node_modules
  3. yarn
Was this page helpful?
0 / 5 - 0 ratings

Related issues

grokcode picture grokcode  ยท  6Comments

nodesocket picture nodesocket  ยท  4Comments

SathyaChenniappan picture SathyaChenniappan  ยท  4Comments

LunarSweeper picture LunarSweeper  ยท  4Comments

ciaoben picture ciaoben  ยท  3Comments