简体   繁体   中英

angular-cli.json create error while adding style.css

I am creating my first angular electron project and here is my error log I am trying to add new fonts and styles in my angular 4 project

I have removed bootstrap from my project because style.css contains all the boostrap code and my personal css

ERROR in multi ./node_modules/MicroFinanceAssets/css/style.css Module not found: Error: Can't resolve '/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css' in '/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/@angular/cli/models/webpack-configs' resolve '/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css' in '/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/@angular/cli/models/webpack-configs' using description file: /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs) Field 'browser' doesn't contain a valid alias configuration after using description file: /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/@angular/cli/package.json (relative path: ./models/webpack-confi gs) using description file: /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/package.json (relative path: ./node_modules/MicroFinanceAssets/css/style.css) no extension Field 'browser' doesn't contain a valid alias configuration /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css.js doesn't exist as directory /home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css doesn't exist [/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroF inanceAssets/css/style.css] [/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css.ts] [/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css.js] [/home/deck/Documents/project/MicroFinance/UI/angular-electron-master/node_modules/MicroFinanceAssets/css/style.css] @ multi ./node_modules/MicroFinanceAssets/css/style.css npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! angular-electron@0.0.0 build: ng build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular-electron@0.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
/home/deck/.npm/_logs/2018-05-16T07_04_57_890Z-debug.log

here is my angular-cli file

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "angular-electron"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "styles": [
        "../node_modules/MicroFinanceAssets/css/style.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
        {
            "project": "src/tsconfig.app.json",
            "exclude": "**/node_modules/**"
        },
        {
            "project": "src/tsconfig.spec.json",
            "exclude": "**/node_modules/**"
        },
        {
            "project": "e2e/tsconfig.e2e.json",
            "exclude": "**/node_modules/**"
        }
    ],
    "test": {
        "karma": {
            "config": "./karma.conf.js"
        }
    },
    "defaults": {
        "styleExt": "css",
        "component": {}
    }
}

if you need any extra code details comment me I will provide you and thank you in advance for your time and consideration

MicroFinanceAssets <Directory>
    - node_modules <Directory>
    - angular-cli.json

you need to run command npm start from(under) directory MicroFinanceAssets

either for testing

run npm i font-awesome --save

and add following line in angular-cli instead your css file

"../node_modules/font-awesome/css/font-awesome.css"

If it gets compiled then your path to css file is wrong

this cli may be help you.. first install bootstrap in your program using npm install bootstrap --save

and change your cli with this code

{
 "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
 "project": {
   "name": "angular-electron"
 },
  "apps": [
       {
           "root": "src",
           "outDir": "dist",
           "assets": [
               "assets",
               "favicon.ico"
           ],
           "index": "index.html",
           "main": "main.ts",
           "polyfills": "polyfills.ts",
           "test": "test.ts",
           "tsconfig": "tsconfig.app.json",
           "testTsconfig": "tsconfig.spec.json",
           "styles": [
               "../node_modules/admin-ample/template/bootstrap/dist/css/bootstrap.css"

           ], 
           "scripts": [
               "../node_modules/admin-ample/plugins/bower_components/jquery/dist/jquery.min.js",

           ],
           "environmentSource": "environments/environment.ts",
           "environments": {
               "dev": "environments/environment.ts",
               "prod": "environments/environment.prod.ts"
           }
       }
   ],
   "e2e": {
       "protractor": {
           "config": "./protractor.conf.js" 

this may help you?

Actually angular 4 has in-built functionality that it can pre-validate.In Angular older version like AJ 1.6 there are no pre-check inside it. So you have to make sure that your CSS has any syntax error and any extra character-word then remove it,and build it. hope fully it will be work

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