Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value at position 0 while updating from Angular 8 to 9

I was updating my project from Angular 8 to 9 when after following the update guide (+ running npm update) on update.angular.io and trying to compile the website using ng serve I get the following error:

ERROR in Failed to compile entry-point angular-font-awesome (es2015 as esm2015) due to compilation errors:
node_modules/angular-font-awesome/dist/angular-font-awesome.js:3968:26 - error NG1010: Value at position 0 in the NgModule.imports of AngularFontAwesomeModule is not a reference: [object Object]

3968                 imports: [CommonModule],

Any help is appreciated.

UPDATE

My ng version output:

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.2
Node: 12.13.1
OS: win32 x64

Angular: 9.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.2
@angular-devkit/build-angular     0.900.2
@angular-devkit/build-optimizer   0.900.2
@angular-devkit/build-webpack     0.900.2
@angular-devkit/core              9.0.2
@angular-devkit/schematics        9.0.2
@angular/cdk                      9.0.0
@angular/cli                      9.0.2
@angular/material                 9.0.0
@ngtools/webpack                  9.0.2
@schematics/angular               9.0.2
@schematics/update                0.900.2
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

My package.json:

{
  "name": "avior",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.0.1",
    "@angular/cdk": "~9.0.0",
    "@angular/common": "~9.0.1",
    "@angular/compiler": "^9.0.1",
    "@angular/core": "~9.0.1",
    "@angular/forms": "~9.0.1",
    "@angular/material": "^9.0.0",
    "@angular/platform-browser": "~9.0.1",
    "@angular/platform-browser-dynamic": "^9.0.1",
    "@angular/router": "~9.0.1",
    "@fortawesome/fontawesome": "^1.1.8",
    "@ngtools/webpack": "^9.0.2",
    "angular-font-awesome": "^3.1.2",
    "angular-tree-component": "^8.5.4",
    "bootstrap": "^4.4.1",
    "chromedriver": "^79.0.3",
    "core-js": "^2.6.11",
    "font-awesome": "^4.7.0",
    "fontawesome": "^5.6.3",
    "gitignore": "^0.6.0",
    "jquery": "^3.4.1",
    "moment": "^2.24.0",
    "popper.js": "^1.16.1",
    "rxjs": "^6.5.4",
    "tslib": "^1.10.0",
    "webdriver-manager": "^12.1.7",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.2",
    "@angular/cli": "^9.0.2",
    "@angular/compiler-cli": "^9.0.1",
    "@angular/language-service": "~9.0.1",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "^12.11.1",
    "angular-ide": "^0.9.73",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.3",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^3.7.5"
  }
}

My tsconfig.ts:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "downlevelIteration": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

UPDATE 2 After uninstalling the angular-font-awesome package I only get one error with an Angular plugin:

ERROR in Failed to compile entry-point angular-tree-component (module as esm5) due to compilation errors:
node_modules/mobx-angular/dist/mobx-angular.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of TreeModule, but could not be resolved to an NgModule class

8 export declare class MobxAngularModule {
like image 255
Munchkin Avatar asked Feb 13 '20 10:02

Munchkin


2 Answers

If you want to use font-awesome in angular 9+ you can use this command :

 ng add @fortawesome/angular-fontawesome

Credit goes to FortAwesome

like image 58
Ali Kianoor Avatar answered Sep 23 '22 23:09

Ali Kianoor


So removing angular-font-awesome using npm uninstall angular-font-awesome and adding new package using ng add @fortawesome/[email protected] and then disabling IVY compiler by adding

"angularCompilerOptions": {
    "enableIvy": false
  }

into tsconfig.app.json and ts.spec.json seems to have solved the issues.

like image 37
Munchkin Avatar answered Sep 22 '22 23:09

Munchkin