nativescript-community / nativescript-community/ui-mapbox

Can't resolve '@nativescript/core/utils'

Open
#28 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
38
Forks
26
PR merge metrics
No merged PRs in 30d

Description

First time using this plugin, I followed the guidelines and can't get it to run :
in my map.ts component :

import { Component, OnInit } from '@angular/core';

import { registerElement } from "nativescript-angular/element-registry";
registerElement("Mapbox", () => require("@nativescript-community/ui-mapbox").MapboxView);

@Component({
	moduleId: module.id,
	selector: 'garages-map',
	templateUrl: './garages-map.component.html',
	styleUrls: ['./garages-map.component.css']
})

export class GaragesMapComponent implements OnInit {

	constructor() { }

	ngOnInit() { }

}

my map.html

<ContentView height="100%" width="100%">
    <Mapbox
        accessToken="my secret key here"
        mapStyle="traffic_day"
        latitude="50.467735"
        longitude="13.427718"
        hideCompass="true"
        zoomLevel="18"
        showUserLocation="false"
        disableZoom="false"
        disableRotation="false"
        disableScroll="false"
        disableTilt="false"
        (mapReady)="onMapReady($event)">
    </Mapbox>
  </ContentView>

and when i run I have this exception :

ERROR in ../node_modules/@nativescript-community/ui-mapbox/mapbox.js
Module not found: Error: Can't resolve '@nativescript/core/utils' in 'appfolder\node_modules\@nativescript-community\ui-mapbox'
 @ ../node_modules/@nativescript-community/ui-mapbox/mapbox.js 5:0-50 2385:20-26 2385:75-81
 @ ./app/map.component.ts
 @ ./app/app.module.ts
 @ ./main.ts

ERROR in ../node_modules/@nativescript-community/ui-mapbox/mapbox.android.js
Module not found: Error: Can't resolve '@nativescript/core/utils' in 'appfolder\node_modules\@nativescript-community\ui-mapbox'
 @ ../node_modules/@nativescript-community/ui-mapbox/mapbox.android.js 5:0-50 2385:20-26 2385:75-81
 @ ../node_modules/@nativescript-community/ui-mapbox/layers/layer-factory.js
 @ ../node_modules/@nativescript-community/ui-mapbox/mapbox.js
 @ ./app/map.component.ts
 @ ./app/app.module.ts
 @ ./main.ts
Executing webpack failed with exit code 2.

My package.json is as follows

{
  "nativescript": {
    "id": "org.nativescript.regooapp",
    "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>",
  "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",
    "@nativescript-community/ui-mapbox": "^6.2.7",
    "@nativescript/theme": "~2.3.0",
    "@nstudio/nativescript-cardview": "^1.0.0",
    "kinvey-nativescript-sdk": "^6.0.0",
    "nativescript-angular": "^8.21.0",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-mediafilepicker": "^4.0.2",
    "nativescript-radial-gradient": "^0.8.0",
    "nativescript-toasty": "^3.0.0-alpha.2",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "^6.5.27",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "nativescript-dev-webpack": "^1.5.1",
    "tns-android": "6.5.3",
    "tns-ios": "6.5.4",
    "tns-platform-declarations": "~6.5.0",
    "typescript": "~3.5.3"
  },
  "readme": "NativeScript Application"
}

I am testing on android

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with package.json and the failing imports in node_modules/@nativescript-community/ui-mapbox/mapbox.js and mapbox.android.js. Compare the declared NativeScript, Angular, and ui-mapbox versions, then run the Android webpack build; done means the unresolved @nativescript/core/utils errors are gone and the map component builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.