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

ng test fails with "Error in config file!" for new project using linked angular-cli #4177

Closed
harunurhan opened this issue Jan 23, 2017 · 4 comments
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@harunurhan
Copy link

I just created a new project to test something but ng test is failing.

Please provide us with the following information:

OS?

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

macOS El Capitan

Versions.

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

angular-cli: 1.0.0-beta.26
node: 5.12.0
os: darwin x64
@angular/common: 2.4.4
@angular/compiler: 2.4.4
@angular/core: 2.4.4
@angular/forms: 2.4.4
@angular/http: 2.4.4
@angular/platform-browser: 2.4.4
@angular/platform-browser-dynamic: 2.4.4
@angular/router: 3.4.4
@angular/compiler-cli: 2.4.4

Repro steps.

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

ng new test-app
cd test-app
ng test

The log given by the failure.

Normally this include a stack trace and some more information.

23 01 2017 11:37:18.541:ERROR [config]: Error in config file!
 { [TSError: ⨯ Unable to compile TypeScript
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (46,25): Cannot find name 'Promise'. (2304)
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (142,43): Property 'assign' does not exist on type 'ObjectConstructor'. (2339)
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (267,25): Cannot find name 'Promise'. (2304)]
  diagnostics: 
   [ '../angular-cli/packages/@ngtools/webpack/src/plugin.ts (46,25): Cannot find name \'Promise\'. (2304)',
     '../angular-cli/packages/@ngtools/webpack/src/plugin.ts (142,43): Property \'assign\' does not exist on type \'ObjectConstructor\'. (2339)',
     '../angular-cli/packages/@ngtools/webpack/src/plugin.ts (267,25): Cannot find name \'Promise\'. (2304)' ] }
TSError: ⨯ Unable to compile TypeScript
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (46,25): Cannot find name 'Promise'. (2304)
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (142,43): Property 'assign' does not exist on type 'ObjectConstructor'. (2339)
../angular-cli/packages/@ngtools/webpack/src/plugin.ts (267,25): Cannot find name 'Promise'. (2304)
    at getOutput (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:258:17)
    at /Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:267:16
    at Object.compile (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:403:17)
    at loader (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:289:33)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:306:14)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module._load.parent [as _load] (/Users/haurhan/ts/angular-cli/lib/bootstrap-local.js:69:24)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/haurhan/ts/angular-cli/packages/@ngtools/webpack/src/index.ts:3:1)
    at Module._compile (module.js:413:34)
    at loader (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:289:14)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/haurhan/ts/cli-test-app/node_modules/ts-node/src/index.ts:306:14)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module._load.parent [as _load] (/Users/haurhan/ts/angular-cli/lib/bootstrap-local.js:56:22)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/haurhan/ts/angular-cli/packages/angular-cli/models/webpack-build-test.js:5:17)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module._load.parent [as _load] (/Users/haurhan/ts/angular-cli/lib/bootstrap-local.js:69:24)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/haurhan/ts/angular-cli/packages/angular-cli/plugins/karma.js:4:30)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module._load.parent [as _load] (/Users/haurhan/ts/angular-cli/lib/bootstrap-local.js:62:22)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at module.exports (/Users/haurhan/ts/cli-test-app/karma.conf.js:12:7)
    at Object.parseConfig (/Users/haurhan/ts/cli-test-app/node_modules/karma/lib/config.js:342:5)
    at new Server (/Users/haurhan/ts/cli-test-app/node_modules/karma/lib/server.js:56:20)
    at /Users/haurhan/ts/cli-test-app/node_modules/angular-cli/tasks/test.js:32:31
    at Class.exports.default.Task.extend.run (/Users/haurhan/ts/cli-test-app/node_modules/angular-cli/tasks/test.js:15:16)
    at Class.TestCommand.extend.run (/Users/haurhan/ts/cli-test-app/node_modules/angular-cli/commands/test.js:30:25)
    at Class.<anonymous> (/Users/haurhan/ts/cli-test-app/node_modules/angular-cli/ember-cli/lib/models/command.js:147:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@filipesilva filipesilva changed the title ng test fails with "Error in config file!" for new project ng test fails with "Error in config file!" for new project using linked angular-cli Jan 23, 2017
@filipesilva
Copy link
Contributor

You should have mentioned you're actually using a linked version of angular-cli btw, this doesn't happen on published versions.

It turns out karma auto-registers ts-node: https://github.com/karma-runner/karma/blob/0bec015ede1c04e4d286c1ed2068c294e517364a/lib/config.js#L29

This messes up our dev setup transpiling. Temporary solution is to rm -rf node_modules/ts-node in the generated project. This in turn will mess up your ng e2e :/

Don't really have a solution for this at the moment. Not terribly important since it's a dev-only issue.

@filipesilva filipesilva added command: test P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Jan 23, 2017
@harunurhan
Copy link
Author

harunurhan commented Jan 23, 2017

Thanks, your solution fixed it for my case since I don't need ng e2e.

Actually I was trying it, at first with my local angular-cli linked, when it failed I tried it on a new project with published @latest angular-cli but apparently forgot to unlink. That's why I didn't mention.

@filipesilva
Copy link
Contributor

Fixed via #4997

@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
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

No branches or pull requests

2 participants