question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing dependency "Moment" on new and upgraded projects, while using OwlNativeDateTimeModule

See original GitHub issue

Even whilst not using Moment.js, there still appears to be a dependency for this date-time-picker. When you try to npm start a new or upgraded project, you will be hit with:

Error: The target entry-point "@danielmoncada/angular-datetime-picker" has missing dependencies:
 - moment

I was able to reproduce the error by creating a new angular app (with Angular Material) and setting up the imports:

@NgModule({
     imports: [ 
         OwlDateTimeModule, 
         OwlNativeDateTimeModule,
     ],

In projects where we used this date-time-picker, we have always used OwlNativeDateTimeModule and never the OwlMomentDateTimeModule, as stated in the documentation. I got the error after upgrading to Cypress 7, so it appears Cypress 6 was our last package that installed moment as a dependency.

As you might know already know, Moment.js is a legacy project. Reason enough to move away from it in new and upgraded projects, as apparently more projects are doing.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
florisvanderhaarcommented, Jun 10, 2021

Yes, installing Moment.js is a valid workaround for the immediate short term.

However, in doing so I will add a package to my application that’s not in active development anymore, while I purposely configured the date-time-picker to use the OwlNativeDateTimeModule instead of Moment. This is a bad practice.

IMHO: The aim should always be to install the least amount of dependencies on a new project and avoid leaving any unwanted, unused or deprecated packages in a project during an upgrade.

Moment.js hadn’t been deprecated yet when the date-time-picker was made. But still the documentation wrongly states:

There are two pre-made modules:

OwlNativeDateTimeModule – support for native JavaScript Date object OwlMomentDateTimeModule – support for MomentJS object. (need to npm install ng-pick-datetime-moment and moment packages)

Source: https://danielykpan.github.io/date-time-picker/#locale-formats

TLDR; I shouldn’t have to install a package I’m not using.

2reactions
danielmoncadacommented, Jan 8, 2022

Okay… finally had time to remove the MomentAdapter, and extract it out into a separate project.

This is in the latest version (https://github.com/danielmoncada/date-time-picker/pull/143) v13.1.0.

If anyone does need a MomentJs adapter, you can find it here npm or GitHub.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extend peer dependencies to Angular 8 · Issue #594 - GitHub
You must install peer dependencies yourself. Steps to reproduce and a minimal demo of the problem. npm install with Angular 8.
Read more >
Angular 9 - The target entry-point has missing dependencies
I had The target entry-point has missing dependencies error when starting my Angular project with npm run start .
Read more >
@danielmoncada/angular-datetime-picker - npm package | Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
Resolving missing dependencies - Zendesk help
This means that when you're in the sandbox, you can see and use them in existing and new triggers. However, if the trigger...
Read more >
There has been a missing dependency failure, check the job ...
Since I upgraded our hosted Gitlab EE and Gitlab-runner to 10.8,I get job failures with the message There has been a missing dependency...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found