TheUnreal
TheUnreal

Reputation: 24492

Module not found: Error: Can't resolve

I upgraded the angular(2.1.2)and angular-cli version to latest, and I get the following error for each component I have:

ERROR in ./src/app/members/view-news/view-news.component.ts
Module not found: Error: Can't resolve 'view-news.component.css' in 'c:\xampp\htdocs\myapp\src\app\members\view-news'
 @ ./src/app/members/view-news/view-news.component.ts 74:21-55
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.ts
 @ multi main

Although the file view-news.component.css exists in the same folder of the view-news.component.ts and worked in previous version. What's wrong?

Upvotes: 2

Views: 13256

Answers (3)

Sameer Bahad
Sameer Bahad

Reputation: 583

here is my Solution

In my case

path is like this "node_modules/jquery/dist/jquery.min.js",

i have corrected it by

"./node_modules/jquery/dist/jquery.min.js",

Actual Code

"styles": [
          "./node_modules/bootstrap/dist/css/bootstrap.min.css"
        ],
        "scripts": [
          "./node_modules/jquery/dist/jquery.min.js",
          "./node_modules/bootstrap/dist/js/bootstrap.min.js"
        ],

Upvotes: 0

cr0mbly
cr0mbly

Reputation: 51

Make sure you change the comments tag from <dom-element> to 'test.html' if you have it surrounding with test.html it will fail.

Upvotes: 0

xwb1989
xwb1989

Reputation: 343

did you try ./view-news.component.css as path?

Upvotes: 6

Related Questions