Angular-cli: ERROR [preprocess]: Can not load "webpack"! TypeError: Cannot read property 'plugin' of undefined

Created on 20 Aug 2017  路  6Comments  路  Source: angular/angular-cli

After installing angular cli, I ran the below commands and able to open the application on browser.
ng new my-dream-app
cd my-dream-app
ng serve

But inorder to do testing, executed ng test command, but getting the below issue. Not sure how to proceed further.

image

Could you please let me know if i did any mistake.

Most helpful comment

It appears you have a much older version of the CLI (still using the package name angular-cli)

You will want to remove that package and install the current version...

npm uninstall angular-cli -g
npm install @angular/cli -g

Also, you'll want to ensure your versions are up to date, which you can find under prerequisites

All 6 comments

I ran into this same issue. I was able to add

"@ngtools/webpack": "^1.6.2"

to the devDependencies as a fix for a newly generated project but this temp fix did not work with another recently created app I developed.
I read about adding a tsconfig.spec.ts as a fix as well here: https://github.com/angular/angular-cli/issues/6457

Currently still unable to fix my issue.

+1

ng -v
angular-cli: 1.0.0-beta.28.3
node: 8.3.0
os: win32 x64

Upgrading to @angular/cli: 1.3.2 solved my issues.

It appears you have a much older version of the CLI (still using the package name angular-cli)

You will want to remove that package and install the current version...

npm uninstall angular-cli -g
npm install @angular/cli -g

Also, you'll want to ensure your versions are up to date, which you can find under prerequisites

I got burned by this as well. I did see the message when running ng test which said

As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,

However, I read this as a forewarning about something that would happen in the future, where I should have read it as something which was in the near-future of the long-ago-past, which means it's still in the past from where the present currently is.

It would have been better if whoever typed the "forewarning" instead said something like "As of __DATE__, the angular-cli repository is deprecated and you should be using @angular/cli"

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naveedahmed1 picture naveedahmed1  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments