angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

TypeError: Cannot read property 'config' of null

Open soodvarun opened this issue 9 years ago • 62 comments

Please provide us with the following information:

OS?

Windows 7

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.31
node: 6.9.4
os: win32 x64
@angular/cli: 1.0.0-beta.31
@angular/common: 2.2.4
@angular/compiler: 2.2.4
@angular/compiler-cli: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.2.4
@angular/http: 2.2.4
@angular/platform-browser: 2.2.4
@angular/platform-browser-dynamic: 2.2.4
@angular/router: 3.2.4
@angular/upgrade: 2.2.4

Repro steps.

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

Added cli later and did ng init

The log given by the failure.

Normally this include a stack trace and some more information.

ng build --prod --verbose
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
   at Class.run (C:\Projects\Someplace\Portal\Someplace\node_modules\@angular\cli\tasks\build.js:14:89)
   at Class.run (C:\Projects\Someplace\Portal\Someplace\node_modules\@angular\cli\commands\build.js:49:26)
   at Class.<anonymous> (C:\Projects\Someplace\Portal\Someplace\node_modules\@angular\cli\ember-cli\lib\models\command.js:134:17)
   at process._tickCallback (internal/process/next_tick.js:103:7)

Mention any other details that might be useful.

The offending line const outputPath = runTaskOptions.outputPath || config_1.CliConfig.fromProject().config.apps[0].outDir;


Thanks! We'll be in touch soon.

soodvarun avatar Feb 16 '17 08:02 soodvarun

Note for others, ensure you don't have angular-cli installed as a dependency anywhere in your package.json. This can also cause it to become the ng inside your node_modules/.bin folder, which will cause this error. You can see by going there and opening the ng file, and you'll notice the angular-cli project references.

If that's the case, just remove angular-cli dependency, delete node_modules and run npm i again - and you'll reinstall everything and the new symlinks will be created pointing to the correct @angular/cli "ng". Hope that helps anyone else in this situation!

MarkPieszak avatar Apr 12 '19 13:04 MarkPieszak

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.