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.

Errors in Angular2 (Angular cli) application after updating from 1.6.1 to version 1.7.0

See original GitHub issue

Hi, I am using linqts within an angular-cli project. There is a problem with linqts, since I updated from 1.6.1 to 1.7.0. I am not sure, if it is a webpack or angular-cli problem - or just my fault. Maybe someone here can help.

system: windows 7 node: v7.3.0 npm: 4.0.2

My project uses angular-cli version 1.0.0-beta.24. When updating linqts to version 1.7.0, the angular 2 app throws this error:

zone.js:682Uncaught Error: Cannot find module "."
    at webpackMissingModule (linq.js:8) [<root>]
    at List.List.elements (linq.js:8) [<root>]
    at Object.<anonymous> (linq.js:13) [<root>]
    at __webpack_require__ (bootstrap c8b9130…:52) [<root>]
    at Object.481 (main.ts:12) [<root>]
    at __webpack_require__ (bootstrap c8b9130…:52) [<root>]
    at Object.482 (app.component.ts:24) [<root>]
    at __webpack_require__ (bootstrap c8b9130…:52) [<root>]
    at Object.372 (src async:7) [<root>]
    at __webpack_require__ (bootstrap c8b9130…:52) [<root>]
    at Object.694 (main.bundle.js:223) [<root>]
    at __webpack_require__ (bootstrap c8b9130…:52) [<root>]
    at webpackJsonpCallback (bootstrap c8b9130…:23) [<root>]
    at :4200/main.bundle.js:1:1 [<root>]
ZoneAwareError @ zone.js:682
webpackMissingModule @ linq.js:8
List.List.elements @ linq.js:8
(anonymous) @ linq.js:13
__webpack_require__ @ bootstrap c8b9130…:52
481 @ main.ts:12
__webpack_require__ @ bootstrap c8b9130…:52
482 @ app.component.ts:24
__webpack_require__ @ bootstrap c8b9130…:52
372 @ src async:7
__webpack_require__ @ bootstrap c8b9130…:52
694 @ main.bundle.js:223
__webpack_require__ @ bootstrap c8b9130…:52
webpackJsonpCallback @ bootstrap c8b9130…:23
(anonymous) @ main.bundle.js:1

To reproduce the Problem create a dummy project with:

  npm install -g webpack
  npm install -g webpack-dev-server
  npm install -g angular-cli
  ng new linqtstest
  cd linqtstest
  npm install linqts@latest -D

Replace the file linqtstest\src\app\app.component.ts with some linqts :

  import { Component } from '@angular/core';
  import { List, Enumerable } from 'linqts';

  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    name: string;
    private linqs: string[];
    constructor() {
      this.name = 'LinqTs + Angular2'
      this.linqs = Enumerable
        .Range(1, 5)
        .Select(i => 'LinqTs ' + i)
        .ToArray();
    }

    foo(l: string): void {
      console.log(l);
      alert(l)
    }
  }

Replace the file linqtstest\src\app\app.component.html with the following

  <div>
    <h2>Hello {{name}}</h2>
      <button *ngFor="let l of linqs" (click)="foo(l)" md-fab>
          <span>{{l}}</span>
      </button>
  </div>

Run the dummy project with:

  ng serve

The app should now run on http://localhost:4200 and You should see the described error. The same app with linqts version 1.6.1 runs without any errors.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
zskovacscommented, Jan 12, 2017

I could reproduce your problem. It looks like WebPack cannot load linq.ts if it is compiled as UMD module. If I recompile it to commonjs, then it works fine. But I’m not sure this is a linq.ts problem. I tried it with SystemJS and it could handle it even if I used it as UMD.

1reaction
kentcdoddscommented, Jan 12, 2017

Hey @kutyel, I generally distribute a UMD version as well as a CommonJS version of my modules. Watch this for more info. One important bit that’s not noted in the video is that your package.json main is set to the CommonJS version. Also, in my video I’m using babel to generate the CommonJS version of my module, but you could use webpack to do this as well (if you need any loaders to run as part of your build for example).

Good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a bunch of Module not found errors after upgrading ...
Upgrade an angular project using cli version 1.6.1 to cli 1.7.0-rc.0. App uses the pubnub-angular2 lib v 1.3.0 ...
Read more >
Angular2 CLI error "@angular/compiler-cli" package was not ...
I resolved it following the "Updating Angular CLI" process in the npm ... The error occure when webpack can not determine the version...
Read more >
Upgrading from AngularJS to Angular
AngularJS is the name for all 1.x versions of Angular. ... When you begin to upgrade these applications to Angular, some will turn...
Read more >
What's new in Angular CLI 1.7? - Ninja Squad
If you want to upgrade to 1.7.0 without pain (or to any other version, by the way), I have created a Github project...
Read more >
How To Update Angular CLI To Latest Version
After updating Angular CLI globally you might get this warning if your local project's angular cli version less than the global angular cli...
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