`ng test` fails, is unable to compile TypeScript
See original GitHub issueOS?
macOS Sierra (10.12.3)
Versions.
@angular/cli: 1.0.0-beta.30 node: 7.5.0 os: darwin x64 @angular/common: 2.4.7 @angular/compiler: 2.4.7 @angular/core: 2.4.7
Repro steps.
ng new cool-app
cd cool-app
ng test
The log given by the failure.
➜ cool-app git:(master) ng test 09 02 2017 19:33:49.134:ERROR [config]: Error in config file! { TSError: ⨯ Unable to compile TypeScript …/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (48,25): Cannot find name ‘Promise’. (2304) …/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (148,43): Property ‘assign’ does not exist on type ‘ObjectConstructor’. (2339) …/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (349,25): Cannot find name ‘Promise’. (2304) at getOutput (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:258:17) at /private/tmp/cool-app/node_modules/ts-node/src/index.ts:267:16 at Object.compile (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:403:17) at loader (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:289:33) at Object.require.extensions.(anonymous function) [as .ts] (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:306:14) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:69:24) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object.<anonymous> (workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/index.ts:1:1) at Module._compile (module.js:571:32) at loader (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:289:14) at Object.require.extensions.(anonymous function) [as .ts] (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:306:14) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:56:22) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object.<anonymous> (workspace/js/ng/angular-cli.git/packages/@angular/cli/models/webpack-configs/test.js:5:17) at Module._compile (module.js:571:32) at Object.Module._extensions…js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:69:24) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object.<anonymous> (workspace/js/ng/angular-cli.git/packages/@angular/cli/plugins/karma.js:4:23) at Module._compile (module.js:571:32) at Object.Module._extensions…js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:62:22) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at module.exports (/private/tmp/cool-app/karma.conf.js:12:7) at Object.parseConfig (/private/tmp/cool-app/node_modules/karma/lib/config.js:342:5) at new Server (/private/tmp/cool-app/node_modules/karma/lib/server.js:56:20) at /private/tmp/cool-app/node_modules/@angular/cli/tasks/test.js:26:31 at Class.run (/private/tmp/cool-app/node_modules/@angular/cli/tasks/test.js:10:16) at Class.run (/private/tmp/cool-app/node_modules/@angular/cli/commands/test.js:29:25) at Class.<anonymous> (/private/tmp/cool-app/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17) at process._tickCallback (internal/process/next_tick.js:103:7) diagnostics: [ ‘…/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (48,25): Cannot find name 'Promise'. (2304)’, ‘…/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (148,43): Property 'assign' does not exist on type 'ObjectConstructor'. (2339)’, ‘…/…/…/workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (349,25): Cannot find name 'Promise'. (2304)’ ] }
Mention any other details that might be useful.
Project is located at /tmp/cool-app Angular CLI is from master, npm link’d
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
This is an unfortunate side effect of Karma auto-loading ts-node. It should only happen on dev setups that have a linked CLI.
Current workaround is to do
rm -rf node_modules/ts-node
on the generated project. This will breakng e2e
untilts-node
is reinstalled locally.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.