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
TypeError: Object(...) is not a function #28
Comments
What version of NGX Logger is installed? |
I'm using Angular 4 and ngx-logger 0.2.7 |
What version of moment? I might need you to try to reproduce this in a plunkr. If the versions seem ok. I'm not sure why it's having trouble finding utc(). |
Angular is 4.2.4 by the way. |
I can confirm this as well on angular 4.4.4.
I might be wrong, but as far as I understand NPM, each package uses its own copy of all dependent libraries (unless you specify it as peer-dependency), so it will use the moment version you defined in the package.json. The locale issue might indeed be a problem with moment itself, see issue moment/#2979 |
@burakkilic, this appears to be an issue with moment. I'm getting the same error when I install moment@2.19.0 For now, I've modified the packages.json to Let me know if this works for you. |
Hmm... @dbfannin how about remove moment.js dependency? https://github.com/dbfannin/ngx-logger/blob/master/src/logger.service.ts#L75 I think _timestamp function can be replaced using new Date().toISOString()
|
@IsNull, older versions of npm would install each dependency in a "node_modules" directory under the package. npm is now doing a flat approach in that in only installs sub dependencies if there already exists the package referenced, but it conflicts with the version needed by the package. In other words. if Now that I've modified |
@leo6104, that's a very good point. There's very little benefit being pulled in from moment. especially since the only thing it is doing is formatting a date to the standard format. |
@dbfannin I just was testing However, this confused me due to the above (wrong) assumptions I've made. Thanks to your explanation I get it now, thank you! I checked even my package lock, and it indeed showed that it switched from 2.19.x to 2.18.x. |
@IsNull 👍 @leo6104, even though |
Yes, 0.2.8 resolved the issue. Thank you! |
I installed ngx-logger as in the manual. When I try to use it like in the code:
I'm getting following warning:
and in the developer console, I'm getting the following error:
Is it because of moment.js? Or is it because of I'm using typescript?
The text was updated successfully, but these errors were encountered: