Angular-cli: Module not found: Error: Can't resolve './'

Created on 21 Feb 2017  路  6Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

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

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.32.3
node: 6.9.2
os: win32 x64

Repro steps.

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

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest
ng new sample
copied app folder from old-sample to new sample
ng serve

The log given by the failure.

Normally this include a stack trace and some more information.

ERROR in ./src/app/user/reset-password/reset.password.component.css
Module not found: Error: Can't resolve './' in 'C:\webweb\src\app\user
t\reset-password'
@ ./src/app/user/reset-password/reset.password.component.css 6:353-3
66
@ ./src/app/user/reset-password/reset-password.component.ts
@ ./src/app/user/index.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

ERROR in ./src/app/user/login/login.test.component.css
Module not found: Error: Can't resolve './' in 'C:\webweb\src\app\user\login'
@ ./src/app/user/login/login.test.component.css 6:363-376
@ ./src/app/usert/login/login.test.component.ts
@ ./src/app/user/index.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

ERROR in ./src/app/user/forgot-password/forgot-password.component.css

Module not found: Error: Can't resolve './' in 'C:\webweb\src\app\userforgot-password'
@ ./src/app/user/forgot-password/forgot-password.component.css 6:353
-366
@ ./src/app/user/forgot-password/forgot-password.component.ts
@ ./src/app/user/index.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

Mention any other details that might be useful.

this error started when i did upgrade angular/cli
i thought the errors could be as a result of referencing css
changed and swap between the following but still didnt work
styleUrls:['./forgot-password.component.css'] styleUrls:['forgot-password.component.css']


Thanks! We'll be in touch soon.

Most helpful comment

4778 maybe?

All 6 comments

4778 maybe?

Are there any imports or url()'s in the stylesheet in question?

yes, remove background-image: url(""); from css did solve my issue.
thanks @mattdistefano and @clydin

Any fix does not involve removing background-image: url("")?

Setting images to url("/assets/images/...") stops it from breaking and works with ng-serve but does not make the correct route change when building to production.

Closing as answered.

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

MateenKadwaikar picture MateenKadwaikar  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

hartjo picture hartjo  路  3Comments

5amfung picture 5amfung  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments