Nativescript: Nativescript CLI 6.8.0 create new Angular project can't build.

Created on 2 Sep 2020  路  8Comments  路  Source: NativeScript/NativeScript

CLI 6.8.0
macOS 10.15.5
nodeJS v12.18.2

I installed the cli @ 6.8.0 and create a new project using Angular Default Template (default is 9.1.0)
And just run "tns run ios" got errors.

How do I fix it?

ERROR in ../node_modules/@nativescript/angular/http-client/http-utils.js
Module not found: Error: Can't resolve '@nativescript/core/file-system/file-system' in '/Users/shelly.chen/SecurityApp/node_modules/@nativescript/angular/http-client'
@ ../node_modules/@nativescript/angular/http-client/http-utils.js 3:20-73
@ ../node_modules/@nativescript/angular/http-client/ns-http-backend.js
@ ../node_modules/@nativescript/angular/http-client/index.js
@ ../node_modules/@nativescript/angular/index.js
@ ./app/app.module.ts
@ ./main.ts

ERROR in ../node_modules/@nativescript/angular/element-registry.js
Module not found: Error: Can't resolve '@nativescript/core/ui/border' in '/Users/shelly.chen/SecurityApp/node_modules/@nativescript/angular'
@ ../node_modules/@nativescript/angular/element-registry.js 141:47-86
@ ../node_modules/@nativescript/angular/index.js
@ ./app/app.module.ts
@ ./main.ts

the package.json file

{
  "nativescript": {
    "id": "org.nativescript.MyApp",
    "tns-android": {
      "version": "6.5.0"
    },
    "tns-ios": {
      "version": "6.5.0"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "ngcc": "ngcc --properties es2015 module main --first-only",
    "postinstall": "npm run ngcc"
  },
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@nativescript/angular": "~9.0.0",
    "@nativescript/theme": "~2.3.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.5.0",
    "tns-core-modules": "~6.5.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~9.1.0",
    "@ngtools/webpack": "~9.1.0",
    "nativescript-dev-webpack": "~1.5.0",
    "tns-platform-declarations": "~6.5.0",
    "typescript": "~3.8.3"
  },
  "readme": "NativeScript Application"
}

All 8 comments

There's no @nativescript/core dependency in your package.json.

Hi !
Same problem. I have been using Nativescript for two years, today my application is based on nativescript 6.5. Since the release of NativeScript 7.0 on August 31, I can no longer build the application. When I look at the package-lock.json, I realize that we forced the installation of "@nativescript/core" : "7.0.0" when I wanted to avoid it for the moment. I use a lot of plugins that don't support the upgrade to Nativescript 7.0.

My package.json :

{
    "nativescript": {
        "id": "com.nativescript.myapp",
        "tns-android": {
            "version": "6.5.3"
        },
        "tns-ios": {
            "version": "6.5.2"
        }
    },
    "description": "NativeScript Application",
    "name": "app-core",
    "license": "SEE LICENSE IN <your-license-filename>",
    "repository": "<fill-your-repository-here>",
    "version": "2.0.5",
    "dependencies": {
        "@angular/animations": "~8.2.0",
        "@angular/common": "~8.2.0",
        "@angular/compiler": "~8.2.0",
        "@angular/core": "~8.2.0",
        "@angular/forms": "~8.2.0",
        "@angular/http": "~8.0.0-beta.10",
        "@angular/platform-browser": "~8.2.0",
        "@angular/platform-browser-dynamic": "~8.2.0",
        "@angular/router": "~8.2.0",
        "@ngxs/store": "~3.6.0",
        "@nstudio/nativescript-pulltorefresh": "^1.1.1",
        "@sentry/browser": "^5.17.0",
        "husky": "^4.0.6",
        "js-sha256": "~0.9.0",
        "lodash": "~4.17.15",
        "mime-types": "^2.1.24",
        "moment": "~2.24.0",
        "nativescript-angular": "^8.21.0",
        "nativescript-app-update": "^1.0.1",
        "nativescript-appversion": "~1.4.2",
        "nativescript-background-http": "~4.2.1",
        "nativescript-dna-deviceinfo": "^2.4.3",
        "nativescript-drop-down": "5.0.4",
        "nativescript-email": "~1.5.4",
        "nativescript-facebook": "~4.2.0",
        "nativescript-geolocation": "^5.1.0",
        "nativescript-google-login": "^1.3.3",
        "nativescript-gtm": "^1.0.0",
        "nativescript-image": "^3.0.6",
        "nativescript-image-zoom": "^3.0.3",
        "nativescript-iqkeyboardmanager": "1.5.1",
        "nativescript-linkedin-signin": "1.0.2",
        "nativescript-localstorage": "2.0.0",
        "nativescript-modal-datetimepicker": "~1.2.0",
        "nativescript-ngx-shadow": "~6.5.0",
        "nativescript-pager": "10.0.0",
        "nativescript-permissions": "~1.3.6",
        "nativescript-platform-css": "~1.6.8",
        "nativescript-plugin-firebase": "~10.5.0",
        "nativescript-secure-storage": "~2.6.0",
        "nativescript-sqlite": "~2.3.3",
        "nativescript-svg-hw": "~1.0.1",
        "nativescript-theme-core": "~2.0.0",
        "nativescript-toasty": "~2.0.0",
        "nativescript-ui-listview": "8.0.0",
        "nativescript-unit-test-runner": "^0.7.0",
        "nativescript-urlhandler": "~1.3.0",
        "node-fetch": "^2.6.0",
        "reflect-metadata": "~0.1.12",
        "rxjs": "~6.5.0",
        "slugme": "~1.1.1",
        "tns-core-modules": "6.5.9",
        "zone.js": "~0.9.1",
        "zxcvbn": "~4.4.2"
    },
    "devDependencies": {
        "@angular/compiler-cli": "~8.2.0",
        "@nativescript/schematics": "~0.7.0",
        "@ngtools/webpack": "~8.3.20",
        "@types/chai": "~4.2.7",
        "@types/karma-chai": "0.1.2",
        "@types/mocha": "7.0.1",
        "@types/node": "~13.1.6",
        "babel-traverse": "6.26.0",
        "babel-types": "6.26.0",
        "babylon": "6.18.0",
        "chai": "4.2.0",
        "css-loader": "~3.4.0",
        "karma": "4.4.1",
        "karma-chai": "0.1.0",
        "karma-mocha": "1.3.0",
        "karma-nativescript-launcher": "0.4.0",
        "karma-webpack": "3.0.5",
        "lazy": "~1.0.11",
        "lint-staged": "^10.0.0-beta.15",
        "mocha": "7.0.1",
        "mocha-junit-reporter": "~1.23.0",
        "mocha-multi": "~1.1.3",
        "mochawesome": "~4.1.0",
        "nativescript-dev-appium": "^6.1.3",
        "nativescript-dev-webpack": "1.5.0",
        "node-sass": "~4.13.0",
        "string-replace-loader": "^2.2.0",
        "tns-platform-declarations": "6.5.9",
        "ts-mocha": "^6.0.0",
        "tslint": "^5.20.1",
        "typescript": "~3.5.3",
        "uglifyjs-webpack-plugin": "^2.2.0"
    },
    "readme": "NativeScript Application",
    "scripts": {
        "e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",
        "e2e-watch": "tsc -p e2e --watch",
        "lint": "tslint",
        "test": "mocha"
    },
    "husky": {
        "hooks": {
            "pre-commit": "lint-staged",
            "pre-push": "if git-branch-is develop; then tns test ios --justlaunch; fi"
        }
    },
    "lint-staged": {
        "*.ts": [
            "npm run lint",
            "git add"
        ]
    }
}

tns --version : 6.4.0

There's no @nativescript/core dependency in your package.json.

I tried to add @nativescript/core 7.0 but still got the same error.

{
  "nativescript": {
    "id": "org.nativescript.SecurityToken",
    "tns-android": {
      "version": "6.5.0"
    },
    "tns-ios": {
      "version": "6.5.0"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "ngcc": "ngcc --properties es2015 module main --first-only",
    "postinstall": "npm run ngcc"
  },
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@nativescript/angular": "~9.0.0",
    "@nativescript/core": "^7.0.0",
    "@nativescript/theme": "~2.3.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.5.0",
    "tns-core-modules": "~6.5.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~9.1.0",
    "@ngtools/webpack": "~9.1.0",
    "nativescript-dev-webpack": "~1.5.0",
    "tns-platform-declarations": "~6.5.0",
    "typescript": "~3.8.3"
  },
  "readme": "NativeScript Application"
}

I think the path is wrong.

file-system is in @nativescript/core/file-system, not @nativescript/core/file-system/file-system

And there is no border module in @nativescript/core/ui, but I found one in tns-core-modules/ui.

There's no @nativescript/core dependency in your package.json.

I tried to add @nativescript/core 7.0 but still got the same error.

What's in your ngcc.config.js file? You could try adding this:

module.exports = {
  packages: {
    "@nativescript/angular": {
      entryPoints: {
        ".": {
          override: {
            main: "./index.js",
            typings: "./index.d.ts",
          },
          ignoreMissingDependencies: true,
        }
      },
      ignorableDeepImportMatchers: [
        /zone.js\//,
        /tns-core-modules\//,
        /@nativescript\/core\//,
      ]
    }
  }
}

There's no @nativescript/core dependency in your package.json.

I tried to add @nativescript/core 7.0 but still got the same error.

What's in your ngcc.config.js file? You could try adding this:

module.exports = {
  packages: {
    "@nativescript/angular": {
      entryPoints: {
        ".": {
          override: {
            main: "./index.js",
            typings: "./index.d.ts",
          },
          ignoreMissingDependencies: true,
        }
      },
      ignorableDeepImportMatchers: [
        /zone.js\//,
        /tns-core-modules\//,
        /@nativescript\/core\//,
      ]
    }
  }
}

I don't change it. It looks like just without this line
/zone.js\//,

I added it but is not working XD

module.exports = {
  packages: {
    "@nativescript/angular": {
      entryPoints: {
        ".": {
          override: {
            main: "./index.js",
            typings: "./index.d.ts",
          },
          ignoreMissingDependencies: true,
        }
      },
      ignorableDeepImportMatchers: [
        /tns-core-modules\//,
        /@nativescript\/core\//,
      ]
    }
  }
};

For older projects, just make sure you have @nativescript/core installed, with the same version as your tns-core-modules dependency. In your case, add "@nativescript/core": "~6.5.0",

For older projects, just make sure you have @nativescript/core installed, with the same version as your tns-core-modules dependency. In your case, add "@nativescript/core": "~6.5.0",

Thank you. It's working. So the template project lacks @nativescript/core dependency.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yclau picture yclau  路  3Comments

Pourya8366 picture Pourya8366  路  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

kn9ts picture kn9ts  路  3Comments

rogangriffin picture rogangriffin  路  3Comments