Skip to content
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

Latest Webpack version of CLI throws error #1887

Closed
siva636 opened this issue Aug 30, 2016 · 22 comments
Closed

Latest Webpack version of CLI throws error #1887

siva636 opened this issue Aug 30, 2016 · 22 comments

Comments

@siva636
Copy link

siva636 commented Aug 30, 2016

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Ubuntu latest 16.04 LTS
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    When run ng --version the following error comes:
    siva@siva:~$ ng --version Error while running script "/home/siva/Applications/node-v4.4.3-linux-x86/lib/node_modules/angular-cli/addon/ng2/models/config/config.ts": SyntaxError: Unexpected token ... at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.require.extensions..ts (/home/siva/Applications/node-v4.4.3-linux-x86/lib/node_modules/angular-cli/lib/bootstrap-local.js:30:14) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/home/siva/Applications/node-v4.4.3-linux-x86/lib/node_modules/angular-cli/addon/ng2/models/config.ts:7:16) at Module._compile (module.js:409:26) at Object.require.extensions..ts (/home/siva/Applications/node-v4.4.3-linux-x86/lib/node_modules/angular-cli/lib/bootstrap-local.js:30:14)

in a Terminal: node --version and paste the result here:

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
  2. The log given by the failure. Normally this include a stack trace and some
    more information.
  3. Mention any other details that might be useful.

Thanks! We'll be in touch soon.

@Daredzik
Copy link

try install npm install -g [email protected]

@olsn
Copy link

olsn commented Aug 30, 2016

have the same issue, but according to this thread #1883 you now need node6 and not node4

@TunaYagci
Copy link

Updating node from 6.3.0 to 6.5.0 helped me too for this problem.

@Daredzik
Copy link

Daredzik commented Aug 30, 2016

to fix this u need go ng init, coz angular-cli.json was modify !!
need to write about it on changelog !!.

go ng init, and go yes only for angular-cli.json and polyfills.ts

@kurtommy
Copy link

kurtommy commented Aug 30, 2016

I' trying the new angular-cli: 1.0.0-beta.11-webpack.8 ...

System: Mac OSX El Capitan

$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64

Repro steps.
ng new projname
cd projname
ng serve

Errors
Project is running but the console reports tons of typings errors like the followings

ERROR in [default] /Users/user/webProjects/test-angular2/webpack/node_modules/@angular/core/src/di/reflective_key.d.ts:18:11
Cannot find name 'Object'.

ERROR in [default] /Users/user/webProjects/test-angular2/webpack/node_modules/@angular/core/src/di/reflective_key.d.ts:23:23
Cannot find name 'Object'.

ERROR in [default] /Users/user/webProjects/test-
angular2/webpack/node_modules/@angular/core/src/di/reflective_key.d.ts:31:22
Cannot find name 'Object'.

ERROR in [default] /Users/user/webProjects/test-angular2/webpack/node_modules/@angular/core/src/di/reflective_provider.d.ts:71:13
Cannot find name 'Function'.

ERROR in [default] /Users/user/webProjects/test-angular2/webpack/node_modules/@angular/core/src/di/reflective_provider.d.ts:80:17
Cannot find name 'Function'.

@ghost
Copy link

ghost commented Aug 30, 2016

This morning things were fine. Now when I create a project and run ng build or ng serve I observe all these errors.

Running on a MacbookPro / El Capitan:
ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.2.1
os: darwin x64

Additional Note: The app runs, regardless. Kind of hard to debug though!

@Kosmonaft
Copy link

Why in CHANGELOG.md the newest version is 1.0.0-beta.11-webpack.3 but everyone is installing 1.0.0-beta.11-webpack.8?

@ghost
Copy link

ghost commented Aug 31, 2016

[email protected] is what is installed with one installs angular-cli@webpack, which is recommended in the angular-cli installation page for RC5 / webpack.

@ghost
Copy link

ghost commented Aug 31, 2016

it is a moving target! Hopefully this is a better version. I'll check it out right now and let you know what I observe.

@Kosmonaft
Copy link

I had really strange situation.
I run npm install -g angular-cli@webpack
Than I checked the version ng -v and it was angular-cli 1.0.0-beta.10
I decided to remove it npm uninstall angular-cli, than npm cache clean.
To ensure that it's deleted I run one more time ng -v and for my surprise the version was 1.0.0-beta.11-webpack.8

I don't have any idea what just happened

@ghost
Copy link

ghost commented Aug 31, 2016

I love it! I just finished the same exercise and got 1.0.0-beta.11-webpack.8! I guess you had an optical illusion (happens to me lot, particularly while playing chess!). Tje problem with the typings still remains.

@ghost
Copy link

ghost commented Aug 31, 2016

OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

MacbookPRO / El Capitan

$ node --version
v6.5.0

$ npm --version
3.10.3

$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64

Repro steps. Was this an app that wasn't created using the CLI? What change did you

do on your code? etc.
Using the above configuration I executed the following steps

$ ng build my_project
$ cd my_project
$ ng build

The log given by the failure. Normally this include a stack trace and some

more information.

This issue seems to be related to issue #1873

It has been suggested that upgrading to node 6.5.0 might solve the problem. Unfortunately, as shown by the logs below, this is not the case:

$ node --version
v6.5.0

$ npm --version
3.10.3

$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64

$ ng build
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
1019ms building modules                                                              
1ms sealing 
0ms optimizing 
1ms basic module optimization 
1ms module optimization 
0ms advanced module optimization 
2ms basic chunk optimization        
1ms chunk optimization 
0ms advanced chunk optimization 
0ms module and chunk tree optimization 
3ms module reviving 
0ms module order optimization 
0ms module id optimization 
1ms chunk reviving 
0ms chunk order optimization 
1ms chunk id optimization 
2ms hashing 
0ms module assets processing 
6ms chunk assets processing 
1ms additional chunk assets processing 
0ms recording 
1ms additional asset processing 
76ms chunk asset optimization
193ms asset optimization
4ms emitting 
Hash: 8633515b4611dd25238a
Version: webpack 2.1.0-beta.21
Time: 1329ms
            Asset       Size  Chunks             Chunk Names
   main.bundle.js    19.3 kB    0, 2  [emitted]  main
 styles.bundle.js      13 kB    1, 2  [emitted]  styles
        inline.js    5.53 kB       2  [emitted]  inline
         main.map    15.4 kB    0, 2  [emitted]  main
       styles.map    17.9 kB    1, 2  [emitted]  styles
       inline.map    5.59 kB       2  [emitted]  inline
       index.html  481 bytes          [emitted]  
assets/.npmignore    0 bytes          [emitted]  
chunk    {0} main.bundle.js, main.map (main) 13.8 kB {1} [initial] [rendered]
chunk    {1} styles.bundle.js, styles.map (styles) 12.7 kB {2} [initial] [rendered]
chunk    {2} inline.js, inline.map (inline) 0 bytes [entry] [rendered]

ERROR in ./src/main.ts
Module not found: Error: Can't resolve '@angular/platform-browser-dynamic' in '/Users/silveir/Projects/studies/ng2_router/src'
 @ ./src/main.ts 2:0-75
 @ multi main

.... many more errors of this nature

Mention any other details that might be useful.

Ive tried the steps above with many different typescript versions

@ghost
Copy link

ghost commented Aug 31, 2016

I was able to solve this problem with the following configuration:

Upgrade imy tools

 node --version
v6.5.0
$ npm --version
3.10.3
$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64

$ npm list -g
/usr/local/lib
├─┬ [email protected]
│ ├── @angular-cli/[email protected]

...

├── [email protected]

....

Changed "typescript": "^2.0.0"to "typescript": "2.0.0"in mypackages.json`

Executed the folling commands on my project root

$ rm -rf node_modules dist tmp typings
$ npm install --save-dev angular-cli@webpack

@kurtommy
Copy link

kurtommy commented Aug 31, 2016

Thanks @dematic-rodrigo-silveira
Changing "typescript": "^2.0.0"to "typescript": "2.0.0"in packages.json works

Now i've upgraded the structure of my project comparing folders and files from a fresh ng new project, there are several differences.
Now i've got this errors and i can't figure out where to remove undefined from the path see the errors below

ERROR in multi main
Module not found: Error: Can't resolve '/Users/user/webProjects/musicollector/undefined/main.ts' in '/Users/user/webProjects/musicollector/node_modules/angular-cli/addon/ng2/models'
 @ multi main

ERROR in Entry module not found: Error: Can't resolve '/Users/user/webProjects/musicollector/undefined/polyfills.ts' in '/Users/user/webProjects/musicollector/node_modules/angular-cli/addon/ng2/models'

ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve '/Users/user/webProjects/musicolle  ctor/undefined/index.html' in '/Users/user/webProjects/musicollector/node_modul  es/angular-cli/addon/ng2/models':
  Error: Can't resolve '/Users/user/webProjects/musicollector/undefined/index.htm  l' in '/Users/user/webProjects/musicollector/node_modules/angular-cli/addon/ng2  /models'

@drpicox
Copy link

drpicox commented Sep 1, 2016

Thanks @dematic-rodrigo-silveira also, as @kurtommy said, no more typings errors appear.
But, I still have issues with MS Visual Code and intellisense.

With:

$ nvm use v4
$ ng --version
angular-cli: 1.0.0-beta.10
node: 4.5.0
os: darwin x64
$ npm --version
3.10.7
$ npm cache clean
$ ng new test-10
$ code test-10

it works perfectly, as expected.

With:

$ nvm use v6
$ ng --version
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64
$ npm --version
3.10.7
$ tsc --version
Version 2.0.0
$ npm cache clean
$ ng new test-11
$ code test-11

MS Studio Code reports some problems (although it is compiled ok):

[ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
[ts] Cannot find name 'Promise'.

¿Any idea?

@DMezhenskyi
Copy link

DMezhenskyi commented Sep 2, 2016

As it was mentioned before you should do next steps to fix this bug:

  1. Install typescript 2.0.0
    npm uninstall typescript -g
    npm cache clean
    npm install [email protected] -g
  2. ng init in project folder
  3. Change the line "typescript": "^2.0.0" to "typescript": "2.0.0" in package.json
  4. run npm install
  5. Enjoy your project.

For me it works good.
Versions:
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64

@drpicox
Copy link

drpicox commented Sep 2, 2016

Nop. ng serve does not throw any error, but MS Visual Code still reporting the same errors.

@siva636
Copy link
Author

siva636 commented Sep 7, 2016

When the next version of CLI likely to come out?

@filipesilva
Copy link
Contributor

Closing as obsolete.

@siva636 please try the latest beta.14.

The typescript@^2.0.0 - >2.0.0 issue was fixed in #1993.

Errors in your editors are because they might not support typescript 2.0.0 yet, there might be a way to configure the editor but it varies.

For other problems please open separate issues.

@drpicox
Copy link

drpicox commented Sep 16, 2016

Now (beta.14) it is working ok (like beta.10) with MS Visual Code.
(may be is the editor that has been updated to v1.5.2)
Thanks @filipesilva

@mazhekin
Copy link

I think the error is stable (ng serve, ng build) repeats when name of the parent folder have somewhere symbol ! (ex. C:/!my-folder). When I renamed it (C:/my-folder) I got success.

@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 7, 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

10 participants