angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.97k forks source link

Webpack.8 Unexpected Token Error After Update #1983

Closed origin1tech closed 8 years ago

origin1tech commented 8 years ago

Please provide us with the following information:

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

El Capitan

  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

node: 4.5.0

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

npm install angular-cli@webpack -g

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

Error while running script "/usr/local/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 (/usr/local/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. (/usr/local/lib/node_modules/angular-cli/addon/ng2/models/config.ts:7:16) at Module._compile (module.js:409:26) at Object.require.extensions..ts (/usr/local/lib/node_modules/angular-cli/lib/bootstrap-local.js:30:14)

  1. Mention any other details that might be useful.

When running version .2 all was well after upgrade I get the above error.


Thanks! We'll be in touch soon.

origin1tech commented 8 years ago

Nevermind looks like it needs Node 6.x

That said after running new command a vanilla project won't build. It throws a bunch of errors related to not finding globals. Going to rollback for the moment.

ERROR in [default] Cannot find name 'Object'

The above is thrown for Object, Array, Function etc...

origin1tech commented 8 years ago

Issue appears to be typescript version. lock out to version 2.0.0

change:

"typescript": "^2.0.0"

to:

"typescript": "2.0.0"

Based on my experience this am I would suggest the following config:

Node: 6.x Npm: 3.x angular-cli:

npm install angular-cli@1.0.0-beta.11-webpack.2 -g

typescript:

npm install typescript@2.0.0 -g

Also ensure that typescript in package.json dev dependencies is locked out as shown above.

EdwinDennis commented 8 years ago

when I create a project with angular-cli not app.module.ts file appears me, anyone know how to fix it?

origin1tech commented 8 years ago

@EdwinDennis are you saying that app.module.ts does not exist?

EdwinDennis commented 8 years ago

do not appear app.module.ts, the versions I have are these ,

node --version v4.4.5 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.10 node: 4.4.5 os: darwin x64

origin1tech commented 8 years ago

Looks like you need to the webpack version of angular-cli

npm install angular-cli@1.0.0-beta.11-webpack.2 -g

I don't believe the default angular-cli uses app.module.ts. At least not the last time I checked.

Be careful though if on an existing project as webpack works significantly different and makes use of the new @types for typescript.

EdwinDennis commented 8 years ago

thanks for the help, update and think the file

angular-automatic-lock-bot[bot] commented 5 years ago

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.