Search code examples
node.jsangularapple-m1

Setting Up Angular Project in M1 Chip


Recently i had to upgrade my Old Macbook to New M1 Chip Mackbook Air due hardware failure. So i had this angular project that i was working on.below is my Package.Json file

    {
  "name": "emporium",
  "version": "2.7.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "dev:ssr": "ng run emporium:serve-ssr",
    "serve:ssr": "node dist/server/main.js",
    "build:ssr": "ng build --configuration production && ng run emporium:server:production",
    "prerender": "ng run emporium:prerender"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "1.1.0",
    "@angular/animations": "13.0.1",
    "@angular/cdk": "13.0.1",
    "@angular/common": "13.0.1",
    "@angular/compiler": "13.0.1",
    "@angular/core": "13.0.1",
    "@angular/flex-layout": "12.0.0-beta.35",
    "@angular/forms": "13.0.1",
    "@angular/material": "13.0.1",
    "@angular/platform-browser": "13.0.1",
    "@angular/platform-browser-dynamic": "13.0.1",
    "@angular/platform-server": "13.0.1",
    "@angular/router": "13.0.1",
    "@frxjs/ngx-timeline": "^1.2.5",
    "@google/maps": "^1.1.3",
    "@nguniversal/express-engine": "13.0.1",
    "@ngx-translate/core": "14.0.0",
    "@ngx-translate/http-loader": "7.0.0",
    "@swimlane/ngx-charts": "19.1.0",
    "@types/googlemaps": "^3.43.3",
    "@types/w3c-web-usb": "^1.0.6",
    "angular-in-memory-web-api": "0.11.0",
    "angular-signature-pad": "^0.0.14",
    "angular2-text-mask": "^9.0.0",
    "aws-amplify": "^4.3.14",
    "bootstrap": "^5.1.3",
    "express": "4.17.1",
    "jspdf": "^2.5.1",
    "jspdf-barcode": "^0.0.6",
    "moment": "^2.29.4",
    "ng-mat-carousel": "^0.11.1",
    "ng-thermal-print": "^1.0.3",
    "ngx-barcode": "^0.3.0",
    "ngx-barcodeput": "^1.1.0",
    "ngx-infinite-scroll": "^10.0.1",
    "ngx-input-file": "10.2.0",
    "ngx-mask": "^11.1.5",
    "ngx-pagination": "5.1.1",
    "ngx-perfect-scrollbar": "10.1.1",
    "ngx-scanner-detection": "^0.0.7",
    "ngx-sortablejs": "^11.1.0",
    "ngx-spinner": "12.0.0",
    "ngx-swiper-wrapper": "10.0.0",
    "rxjs": "7.4.0",
    "sortablejs": "^1.15.0",
    "swiper": "6.6.1",
    "tslib": "2.3.1",
    "uuid": "^8.3.2",
    "uuid-int": "^3.1.0",
    "zone.js": "0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.3.9",
    "@angular/cli": "13.0.2",
    "@angular/compiler-cli": "13.0.1",
    "@angular/language-service": "13.0.1",
    "@nguniversal/builders": "13.0.1",
    "@types/express": "4.17.13",
    "@types/jasmine": "3.10.2",
    "@types/jasminewd2": "2.0.10",
    "@types/node": "16.11.7",
    "@types/sortablejs": "^1.10.7",
    "codelyzer": "^0.0.28",
    "jasmine-core": "3.10.1",
    "jasmine-spec-reporter": "7.0.0",
    "karma": "^6.4.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage-istanbul-reporter": "3.0.3",
    "karma-jasmine": "4.0.1",
    "karma-jasmine-html-reporter": "1.7.0",
    "protractor": "7.0.0",
    "ts-node": "10.4.0",
    "typescript": "4.4.4"
  }
}

my Global Angular version as below

Air ~ % ng version

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

Angular CLI: 13.3.11
Node: 14.21.3
Package Manager: npm 9.8.1
OS: darwin x64

Angular: 12.2.0
... core

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1303.11 (cli-only)
@angular-devkit/core         13.3.11 (cli-only)
@angular-devkit/schematics   13.3.11 (cli-only)
@schematics/angular          13.3.11 (cli-only)
    
 

but when i try to install npm i here is the output i'm getting

Application % npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @agm/core@1.1.0
npm ERR! Found: @angular/common@13.0.1
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"13.0.1" from the root project
npm ERR!   peer @angular/common@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.0.1
npm ERR!   node_modules/@angular/cdk
npm ERR!     @angular/cdk@"13.0.1" from the root project
npm ERR!     peer @angular/cdk@"13.0.1" from @angular/material@13.0.1
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"13.0.1" from the root project
npm ERR!     1 more (@swimlane/ngx-charts)
npm ERR!   16 more (@angular/flex-layout, @angular/forms, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0" from @agm/core@1.1.0
npm ERR! node_modules/@agm/core
npm ERR!   @agm/core@"1.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/common@8.2.14
npm ERR! node_modules/@angular/common
npm ERR!   peer @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0" from @agm/core@1.1.0
npm ERR!   node_modules/@agm/core
npm ERR!     @agm/core@"1.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/aruna/.npm/_logs/2023-09-09T00_03_33_907Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/aruna/.npm/_logs/2023-09-09T00_03_33_907Z-debug-0.log
aruna@Arunas-Air Application % 

npm version command inside the project

-Air Application % npm version
{
  emporium: '2.7.0',
  npm: '9.8.1',
  node: '16.20.2',
  v8: '9.4.146.26-node.26',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.19.1',
  modules: '93',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.11',
  openssl: '1.1.1v+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022f',
  unicode: '14.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}



 Application % nvm ls
       v14.21.3
->     v16.20.2
default -> 14 (-> v14.21.3)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.20.2) (default)
stable -> 16.20 (-> v16.20.2) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3
lts/gallium -> v16.20.2
lts/hydrogen -> v18.17.1 (-> N/A)
aruna@Arunas-Air Application % 

what could be the reason for above error


Solution

  • @agm/core is an old library that isn't maintained anymore and have Angular 6/7/8 as peer-dependency.

    You can either try your luck with --force to install the deps.

    But keep in mind that this lib won't be working with Angular 16+ (Angular has dropped support for non-Ivy libs) .