Skip to content

[RC6 Update w/ webpack 2.1.0-beta.21 incompat] Uncaught TypeError: Cannot read property 'Emulated' of undefined #1948

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

Closed
edcarroll opened this issue Sep 1, 2016 · 21 comments

Comments

@edcarroll
Copy link

edcarroll commented Sep 1, 2016

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Windows 10 Pro x64
    Build 14393.rs1_release_inmarket.160819-1924
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: local (v1.0.0-beta.11-webpack.8, branch: master)
    node: 6.3.1
    os: win32 x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    $ ng new
    Upgrade to rc.6
    $ ng serve
    Error appears when opening in browser
  4. The log given by the failure. Normally this include a stack trace and some
    more information.
    config.js:15Uncaught TypeError: Cannot read property 'Emulated' of undefinedCompilerConfig @ config.js:15(anonymous function) @ compiler.js:75__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ main.bundle.js:50229__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ main.bundle.js:13600__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ main.bundle.js:56646__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ main.bundle.js:56624__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ version.js:1__webpack_require__ @ bootstrap 76af11c…:52(anonymous function) @ main.bundle.js:67347__webpack_require__ @ bootstrap 76af11c…:52webpackJsonpCallback @ bootstrap 76af11c…:23(anonymous function) @ main.bundle.js:1
  5. Mention any other details that might be useful.

Thanks! We'll be in touch soon.

@edcarroll
Copy link
Author

package.json dependencies:

{
    "@angular/common": "2.0.0-rc.6",
    "@angular/compiler": "2.0.0-rc.6",
    "@angular/compiler-cli": "0.6.0",
    "@angular/core": "2.0.0-rc.6",
    "@angular/forms": "2.0.0-rc.6",
    "@angular/http": "2.0.0-rc.6",
    "@angular/platform-browser": "2.0.0-rc.6",
    "@angular/platform-browser-dynamic": "2.0.0-rc.6",
    "@angular/router": "3.0.0-rc.2",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.11",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.17"
}

@celliott181
Copy link
Contributor

Angular-CLI does not yet work with Angular 2 RC6. See #1937 and the latest comments in #1901

@hassanasad
Copy link

Please try updating to Node 6.5.0 - that seemed to fix issues for lots of people. Not sure about Windows machine though.

@GregOnNet
Copy link

Hi @hassanasad ,

updating NodeJS had no effect on my machine.
Can you explain why NodeJS and the compilation process could be related.

@churchilllake
Copy link

churchilllake commented Sep 5, 2016

In #11359 I suggest a specific line causing the problem.

@slyedoc
Copy link

slyedoc commented Sep 6, 2016

reverted to es5, no issues.

in es6, didn't seem to see the import for ViewEncapsulation correctly, closure had WEBPACK_IMPORTED_MODULE_0__angular_core instead of ViewEncapsulation, don't know enough enough about import to know if this is normal

@ronzeidman
Copy link

I'm not using angular-cli (using webpack directly) and I've encountered the same issue. Verifying that I have the right versions of node/npm/typescript didn't help, the only thing that solved it is changing the tsconfig "module": "es6", --> "module": "commonjs",
I'm writing this here since google sends people searching for "Cannot read property 'Emulated' of undefined" here.
This issue is weird since I have another project that works with the same configuration + es6 module, same machine and there are no issues...
This is probably a webpack2 issue so someone probably should to open an issue there.

@kover
Copy link

kover commented Sep 7, 2016

This definitely helps.

GregOnNet pushed a commit to GregOnNet/angular2-testing-playground that referenced this issue Sep 7, 2016
@jtsom
Copy link
Contributor

jtsom commented Sep 7, 2016

Good god.. I can't wait until all of the various moving pieces for Angular 2 get locked down - between fighting with AngularCLI versions, Typescript versions (can't use 2.0.2, that breaks, gotta lock it to 2.0.0), and Angular itself (RC6), trying to get a dev environment set up is an exercise in futility! (my company is looking into Angular 2 for it's next dev platform, and having to say well there are all these issues just to get started, makes one want to look at other, more stable, platforms!)

@TheLarkInn
Copy link
Member

Listen up

😄 This issue was caused by webpack not being able to handle deep namespaced reexports appropriately (packages got rearranged for RC6) while trying to treeshake: see #2953

Updating to [email protected] will solve this issue.

This issue is also fixed on master for the CLI as of yesterday #2011.

@TheLarkInn
Copy link
Member

Fixed with #2011

@TheLarkInn TheLarkInn changed the title Uncaught TypeError: Cannot read property 'Emulated' of undefined [RC6 Update w/ webpack 2.1.0-beta.21 incompat] Uncaught TypeError: Cannot read property 'Emulated' of undefined Sep 8, 2016
@jtsom
Copy link
Contributor

jtsom commented Sep 8, 2016

Yup. Shame trying to install master, using the directions
https://github.com/angular/angular-cli/tree/e20af2109ecd844bba4d64039fb31624afea6399#updating-angular-cli
fail with all sorts of errors:

[email protected] C:\code\angular-cli
+-- UNMET PEER DEPENDENCY @angular/platform-server@^2.0.0-rc.6
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
| `-- [email protected]
|   `-- [email protected]
|     `-- [email protected]
|       `-- [email protected]
|         `-- [email protected]
`-- UNMET PEER DEPENDENCY zone.js@^0.6.17

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN @angular/[email protected] requires a peer of @angular/platform-server@^2.0.0-rc.6 but none was installed.
npm WARN @angular/[email protected] requires a peer of zone.js@^0.6.17 but none was installed.
npm WARN @angular/[email protected] requires a peer of typescript@^1.9.0-dev but none was installed.
npm WARN [email protected] requires a peer of [email protected] || 2.x.x but none was installed.
npm WARN [email protected] requires a peer of typescript@^1.8.0 || ^1.9.0-dev but none was installed.

and yes I have typescript 2.0.2 installed:
PS C:\code\angular-cli> tsc -v Version 2.0.2

Sigh. Now I have to clean up back to working state...

@mattma
Copy link

mattma commented Sep 10, 2016

@TheLarkInn I am using the current master branch, generate a brand new "angular2" project, run ng serve, still get the same error. config.js:15Uncaught TypeError: Cannot read property 'Emulated' of undefined

I checked my angular-cli project dependency webpack is beta.22, but inside the newly generated project using angular-cli dependency beta.8. so it is still using webpack beta 11.

 ng serve
** NG Live Development Server is running on http://localhost:4200. **
3512ms building modules                 2ms add01521ms 882ms asset39ms emittinggHash: 4993f7e77698840ac956
Version: webpack 2.1.0-beta.21

Should you cut a new release like angular-cli beta.9, so it gets the latest webpack 2.1.0-beta.22? Or tried with installing local webpack beta.22, but it seems that it only takes from angular-cli internal webpack dependency

@richavyas
Copy link

richavyas commented Sep 12, 2016

Hi @TheLarkInn,
reported a new issue #2065 instead of adding a new comment on 10 days old thread, Thanks.

@Pekes317
Copy link

I was having the same issue and I uninstalled angular-cli globally and locally. Re-installed it globally then updated the package JSON and started a new project. I then updated the local JSON and uninstalled Webpack and reinstalled beta 22. Although I think updating the JSON and uninstalling Webpack and installing beta 22. You might have to update the Node Modules as whole though.

@richavyas
Copy link

I tried the solution that you suggested @Pekes317, local JSON and uninstalled Webpack and reinstalled beta 22 and updated complete Node Modules too but when I run ng serve, it eventually shows Webpack version as Version: webpack 2.1.0-beta.21, doesn't matter my local package.json and even npm list include "webpack": "2.1.0-beta.22".
Absolutely clueless what to do.

@kover
Copy link

kover commented Sep 13, 2016

@richavyas go to node_modules/angular-cli npm install [email protected] --save this will update webpack installation in angular-cli.

@richavyas
Copy link

Thanks @kover, it worked!!!!!!

@sharpmachine
Copy link

Holy heck this is a mess.

@cbassols
Copy link

cbassols commented Sep 16, 2016

I updated NodeJS to version 6.6.0 and it solved the problem.

Thanks @hassanasad for your suggestion 😀 👍

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests