简体   繁体   中英

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?

您是否尝试将./view-news.component.css作为路径?

如果将test.html周围的注释标记从<dom-element>更改为'test.html',请确保它将失败。

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"
        ],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM