Bar*_*ear 17 javascript npm typescript angular-cli angular
我创建了一个新项目,但每当我编译时都会收到以下 2 条错误消息:
错误:找不到模块:错误:无法解析“C:\Users\Avishek”中的“C:/Users/Avishek/Documents/practice/frontend/src/app/pages/admin/authentication/authentication.component.css” \文档\练习\前端'
和
错误:加载程序“C:/Users/Avishek/Documents/practice/frontend/src/app/pages/admin/authentication/authentication.component.css”未返回字符串。
我从未遇到过此类问题,甚至几天前我创建了一个具有相同角度版本的项目仍然没有得到。下面分别是我的tsconfig.json
&package.json
文件。
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"paths": {
"@directive/*": ["src/app/core/directives/*"],
"@guard/*": ["src/app/core/guards/*"],
"@interceptor/*": ["src/app/core/interceptors/*"],
"@pipe/*": ["src/app/core/pipes/*"],
"@service/*": ["src/app/core/services/*"],
"@custom-validator/*": ["src/app/core/validators/*"],
"@model/*": ["src/app/core/models/*"],
"@store/*": ["src/app/core/store/*"],
"@feature/*": ["src/app/features/*"],
"@page/*": ["src/app/pages/*"],
"@shared/*": ["src/app/shared/*"]
}
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
"strictPropertyInitialization": false
}
}
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "project",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.1.1",
"@angular/cdk": "^12.2.4",
"@angular/common": "~12.1.1",
"@angular/compiler": "~12.1.1",
"@angular/core": "~12.1.1",
"@angular/forms": "~12.1.1",
"@angular/material": "^12.2.4",
"@angular/platform-browser": "~12.1.1",
"@angular/platform-browser-dynamic": "~12.1.1",
"@angular/router": "~12.1.1",
"@kolkov/angular-editor": "^1.2.0",
"@ngxs/store": "^3.7.2",
"rxjs": "~6.6.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.1.1",
"@angular/cli": "~12.1.1",
"@angular/compiler-cli": "~12.1.1",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"typescript": "~4.3.2"
}
}
Run Code Online (Sandbox Code Playgroud)
请帮忙看看这是什么类型的问题以及我该如何解决它。
Neu*_*ino 40
我的情况的问题是我的项目配置为使用scss
文件,但我从使用文件的示例中复制了一些代码css
。所以在我的一个组件中我有:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
Run Code Online (Sandbox Code Playgroud)
stypeUrls 属性中的文件css
是导致错误的原因。