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.

angular2 Error: Cannot find module "."

See original GitHub issue

Just use it in angular 2.2.3 and webpack. And it throw Error: Cannot find module "."

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
vigiecommented, Mar 1, 2017

@inorganik It’s not clear to me if there is any issue here, as per my last comment.

As documented in the README, you must make sure the Countup object is available to your application as a global.

This needs to be the case irrespective of how you bundle or load modules. The Angular directive is a simple wrapper around the core technology, which happens to be a javascript global.

I have never used webpack, but according to @szykov’s comment there is a plugin for webpack called ProvidePlugin that is able to provide globals. People using webpack should try using that, or similar.

I will try to find time to personally verify the webpack scenario, hopefully by this weekend.

In the meantime I would recommend closing this issue, unless @szykov or @hameltomor have experienced any errors when following the instructions? I have been using this directive for a while now and never encountered any issues.

1reaction
JWesorickcommented, Aug 1, 2017

I’m still having this issue with a fresh Angular 4 app. I’ve included the CountUpModule in my app.

...
import { ClaimModule } from './claim/claim.module';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    ...
    CountUpModule
  ],
...
})

export class AppModule {}

And I’ve added

import 'countup.js/dist/countUp';
import 'countup.js/dist/angular-countUp';

to polyfills.ts. And the error in the console:

countUp.module.js:15 Uncaught Error: Cannot find module "."
    at webpackMissingModule (countUp.module.js:15)
    at webpackJsonp.../../../../countup.js/dist/countUp.module.js.Object.defineProperty.value (countUp.module.js:15)
    at Object.../../../../countup.js/dist/countUp.module.js (countUp.module.js:21)
    at __webpack_require__ (bootstrap bde483c5bce87e16b45c:54)
    at Object.../../../../../src/app/app.module.ts (app.config.ts:5)
    at __webpack_require__ (bootstrap bde483c5bce87e16b45c:54)
    at Object.../../../../../src/main.ts (environment.ts:8)
    at __webpack_require__ (bootstrap bde483c5bce87e16b45c:54)
    at Object.2 (main.bundle.js:3825)
    at __webpack_require__ (bootstrap bde483c5bce87e16b45c:54)
webpackMissingModule @ countUp.module.js:15
webpackJsonp.../../../../countup.js/dist/countUp.module.js.Object.defineProperty.value @ countUp.module.js:15
../../../../countup.js/dist/countUp.module.js @ countUp.module.js:21
__webpack_require__ @ bootstrap bde483c5bce87e16b45c:54
../../../../../src/app/app.module.ts @ app.config.ts:5
__webpack_require__ @ bootstrap bde483c5bce87e16b45c:54
../../../../../src/main.ts @ environment.ts:8
__webpack_require__ @ bootstrap bde483c5bce87e16b45c:54
2 @ main.bundle.js:3825
__webpack_require__ @ bootstrap bde483c5bce87e16b45c:54
webpackJsonpCallback @ bootstrap bde483c5bce87e16b45c:25
(anonymous) @ main.bundle.js:1
client?ffdb:41 [WDS] Warnings while compiling.
client?ffdb:106 ./~/countup.js/dist/countUp.module.js
15:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module (Angular 2) - Stack Overflow
But I can't get rid of error. Cannot find module app/search/search.module. Folder "search" is in the "app" folder, the path is correct.
Read more >
Build:cannot find module 'angular2/core' Error - Syncfusion
Hi, First time working with MVC/Syncfusion. I just open the standard MVC template and installed Syncfusion according to the instructions but before even...
Read more >
Cannot find module '@angular/core' error | bobbyhadz
To solve the error "Cannot find module '@angular/core'", make sure you have installed all dependencies by running the npm install command, set the...
Read more >
UI NG Bootrstrap : Cannot find module 'angular2-text-mask ...
It seems that the module @ng2-dynamic-forms/ui-ng-bootstrap use the 'angular2-text-mask' ... Module not found: Error: Can't resolve 'angular2-text-mask' in ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
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