nativescript-permissions icon indicating copy to clipboard operation
nativescript-permissions copied to clipboard

Can't resolve '@master.technology/permissions' in version 1.3.12

Open tylerablake opened this issue 3 years ago • 31 comments

After cleaning and rebuilding my mobile app I'm getting the following error:

ERROR in ../node_modules/nativescript-permissions/permissions.js
Module not found: Error: Can't resolve '@master.technology/permissions' in '/mobile-app/booking/node_modules/nativescript-permissions'
 @ ../node_modules/nativescript-permissions/permissions.js 13:17-58
 @ ../node_modules/@nativescript/geolocation/index.js
 @ ./modules/club/components/search/search.component.ts
 @ ./modules/scores/pages/form/form.component.ts
 @ ./modules/scores/pages/index.ts
 @ ./modules/scores/scores.module.ts
 @ ./routing/app.routing.ts
 @ ./app.module.ts
 @ ./main.ts
Executing webpack failed with exit code 2.

Let me know if there are any other details I can provide to help resolve this, thanks!

tylerablake avatar Nov 02 '21 20:11 tylerablake

Can you tell me:

  1. NativeScript version (ns --version)
  2. What version of typescript you are using.
  3. What version of node & npm you are using.
  4. If there is a @master.technology/permissions folder in either the root node_modules/ or in node_modules/nativescript-permissions/node_modules

NathanaelA avatar Nov 02 '21 22:11 NathanaelA

Yeah no problem!

  1. NativeScript version (ns --version)

8.0.1

  1. What version of typescript you are using.

3.9.7

  1. What version of node & npm you are using.

node - v11.3.0 npm - 6.4.1

  1. If there is a @master.technology/permissions folder in either the root node_modules/ or in node_modules/nativescript-permissions/node_modules

There is a @master.technology/permissions folder in the root but not inside of the nativescript/permissions folder

Let me know if you need anything else!

tylerablake avatar Nov 02 '21 23:11 tylerablake

Node 11 is actually pretty old, that might be the cause. But one thing that might fix the issue on your machine without upgrading node is just copying the @master.technology folder from the root node_modules into the nativescript_permissions/node_modules.

NathanaelA avatar Nov 03 '21 02:11 NathanaelA

Can confirm this is happening here as well. Looks like with the latest change this repo now points to another repo, but perhaps doesn't export from package.json ?

Node 14 here

alexziskind1 avatar Nov 03 '21 12:11 alexziskind1

It does now point to another npm module (@master.technology/permissions) When I first started all my plugins NPM didn't have any name spaces. Now as I update plugins I've been moving them into my own name space. However to keep from breaking everybody I release a shim package that redirects to the new name.

I've done this many times over the years. In fact that is how Plugins -> NS-Permssions works, one plugin refers to the other. And how all my "sub-plugins" of NS-Sqlite work.

I'm at a loss as to why it isn't working for several of you. It is working for the vast majority of people (close to 600 downloads of this version already), otherwise the number of issues would be crazy high.

At the moment, everything "here" is working perfectly on both iOS and Android. I even manually made my demo app go to the latest npm version of ns-permissions (rather than its final location of @master.technology/permissions) just to verify that the chaining would work and it is working for me.

Interim solutions:

  1. You can for sure fix this by updating all references to use @master.technology/permissions instead of the old nativescript-permissions name.
  2. You can update your webpack rules to rewrite (nativescript-permissions to @master.technology/permissions)
  3. You can also use a older version of nativescript-permissions (pre @master.technology/permissions branch) but then you lose the shared ios & android permission ability as the new version of permissions supports getting permissions on both platforms now.

I would like to know a couple things:

  1. What version of Node & NPM
  2. What version of NativeScript CLI you are using (tns --version)
  3. Your apps package.json file.

NathanaelA avatar Nov 03 '21 18:11 NathanaelA

Experiencing the same issue. Stripped 3. to only contain nativescript modules.

  1. 14
  2. 6.8.0
    "@nstudio/nativescript-checkbox": "1.0.0",
    "@nstudio/nativescript-pulltorefresh": "^1.0.1",
    "nativescript": "6.8.0",
    "nativescript-angular": "^8.0.2",
    "nativescript-email": "^1.6.0",
    "nativescript-image": "^2.2.5",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-pdf-view": "^2.2.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toasty": "^2.0.1",
    "nativescript-ui-listview": "^8.2.0",
    "tns-core-modules": "^6.5.20",

Swamp3 avatar Nov 04 '21 09:11 Swamp3

@swamp3 , @alexziskind1 , @tylerablake - are any of you by any chance using the NS/Angular code sharing Schematics?

NathanaelA avatar Nov 04 '21 15:11 NathanaelA

I'm using NS + Angular but not code sharing schematics

tylerablake avatar Nov 04 '21 18:11 tylerablake

@NathanaelA if you are talking about the following code block, then yes. We are also sharing code for a web and the nativescript apps. (.ts and .tns.ts files etc.)

  "cli": {
    "defaultCollection": "@nativescript/schematics"
  },

Swamp3 avatar Nov 05 '21 07:11 Swamp3

@Swamp3 - Yep, that probably means that everything was setup by NS schematics, even if you aren't using it for code sharing. Not 100% sure, but it does seem like everyone so far effected there project was setup using the @ns/schematics or perhaps it is just angular users in general??? (@alexziskind1 - how was your project set up?). The reason I suspected schematics (or even maybe xplat???) is that they have custom resolving for typescript and perhaps this is the reason it isn't working is because it doesn't search proper node_modules folder.

A couple things you can try:

  1. Copy the @master.technology/permissions into the nativescript-permissions/node_modules folder (create the node_modules folder in there if if it doesn't already exist).
  2. Copy the @master.technology/permissions into the very root node_modules folder which I believe is all the way at the base of the schemetics setup.

If either of those works, then it is probably a resolving rule of the tsconfig file needs to be fixed.

NathanaelA avatar Nov 05 '21 17:11 NathanaelA

Hi, i have the same issue as above. I'm using code sharing too.

  1. node : 12.19 + npm 6.4.18
  2. 8.1.3 (tried in 6.5 too) we are using a NS 6 project.
  3. "@angular/animations": "8.0.0", "@angular/common": "8.0.0", "@angular/compiler": "8.0.0", "@angular/core": "8.0.0", "@angular/forms": "8.0.0", "@angular/http": "8.0.0-beta.10", "@angular/platform-browser": "8.0.0", "@angular/platform-browser-dynamic": "8.0.0", "@angular/router": "8.0.0", "@master.technology/permissions": "^2.0.1", "@nativescript/appversion": "^2.0.0", "@nstudio/nativescript-floatingactionbutton": "^1.0.1", "@types/mathjs": "^6.0.5", "core-js": "^2.5.4", "crypto-js": "^3.1.9-1", "mathjs": "^7.1.0", "moment": "^2.23.0", "nativescript": "^6.1.0", "nativescript-angular": "8.0.2", "nativescript-camera": "^4.1.1", "nativescript-drop-down": "^4.0.1", "nativescript-feedback": "^1.3.11", "nativescript-image-swipe": "^5.0.1", "nativescript-imagepicker": "^6.3.0", "nativescript-localize": "^4.2.0", "nativescript-multi-select": "^1.0.6", "nativescript-sqlite": "^2.3.3", "nativescript-theme-core": "~1.0.4", "nativescript-ui-gauge": "5.0.0", "nativescript-ui-listview": "7.0.0", "nativescript-ui-sidedrawer": "7.0.0", "reflect-metadata": "~0.1.8", "rxjs": "^6.5.3", "tns-android": "^6.1.0", "tns-core-modules": "^6.1.0", "typeorm": "0.2.13", "zone.js": "0.9.1"

I already have @master.technology/permissions in the correct location (where you advise to past the module), i still have the same error as others.

RomainTex avatar Nov 09 '21 15:11 RomainTex

@RomainTex -

  1. Can you verify that you have a copy of the @master.technology/permissions in the app/node_modules/nativescript-permissions/node_modules/[HERE]
  2. Was this project setup using xplat or angular schematics?

For everyone else we are already at about 1,200 downloads a week on this version:

  • Does anyone have a non-angular project that this is occurring on?
  • Anyone have a non-xplat or non-schematic Angular setup? Just a project setup via tns create myproject --ng that duplicates this issue.
  • Figuring out the thing that is different in your setup from the vast majority of people is what we need to figure out...

NathanaelA avatar Nov 09 '21 17:11 NathanaelA

Thank you for you quick answer @NathanaelA

  1. I can confirm you that the package is present (I tried this in two environments: Linux and Mac:both have the error since one week for android build) but it did not fix the problem.
  2. I think we used tns to create our project. I am not sure what you mean by a setup using angular schematics.

I will try to reproduce the error in a new project. I keep you posted if i succeed in reproducing the behaviour.

RomainTex avatar Nov 10 '21 08:11 RomainTex

@NathanaelA I found this on stack overflow: https://stackoverflow.com/questions/69841570/error-in-nativescript-permissions-when-running-android-app. Maybe it can help to find the problem.

asixela avatar Nov 10 '21 08:11 asixela

@NathanaelA I did succeed in reproducing the error in a new project. With:

  • nativescript-cli: 6.5.1
  • node 10.21 and npm 6.14.4

Steps to reproduce:

  1. tns create --ng titi
  2. tns plugin add nativescript-imagepicker
  3. Modify the app.component.ts to use the lib, something like that:
import { Component } from "@angular/core";
import { ImageSource } from "tns-core-modules";
import * as imagepicker from "nativescript-imagepicker";


@Component({
    selector: "ns-app",
    templateUrl: "./app.component.html"
})
export class AppComponent { 

    public async selectPicture(): Promise<ImageSource> {
        let newPicture: ImageSource;
        const context = imagepicker.create({
            mode: "multiple"
        });

        await context.authorize().then(
            async () => {
            await context.present().then(
                (selection) => {
                selection.forEach(async (imageAsset) => {
                    const image = new ImageSource();
                    await image.fromAsset(imageAsset).then(source => {
                    newPicture = source;
                    });
                });
                }
            );
            },
            () =>
                console.log("error")
        );

    return newPicture;
  }
}
  1. Run: tns run android

And you should have the following error:

ERROR in ../node_modules/nativescript-permissions/permissions.js Module not found: Error: Can't resolve '@master.technology/permissions' in '/media/romain/storage/work/poc/titi/node_modules/nativescript-permissions' @ ../node_modules/nativescript-permissions/permissions.js 13:17-58 @ ../node_modules/nativescript-imagepicker/imagepicker.js @ ./app/app.component.ts @ ./app/app.module.ts @ ./main.ts

RomainTex avatar Nov 10 '21 09:11 RomainTex

Migrating from NativeScript 7 to NativeScript 8 fixed the issue for me. To migrate see the link https://v6.docs.nativescript.org/angular/releases/upgrade-instructions

$ tns migrate

After migration, when running the app it might say thar zone.js not found. For that the fix is available at: https://github.com/manfredsteyer/ngx-build-plus/issues/4 Add import 'zone.js' in main.ts

However, a lot of libraries i.e. Apollo is not adaptable with NativeScript 8. Is there any way to make this library compatible with NativeScript 7?

zuhairmhtb avatar Nov 13 '21 09:11 zuhairmhtb

if you still did not get the issue resolved then follow these instructions -

  1. go to nativescript-permissions in node_modules
  2. rename or delete permission.js file
  3. now go to @master.technology/permission folder
  4. copy permissions.android.js and permissions.ios.js file
  5. paste these files to nativescript-permissions folder 6 Capture .

manojkumawat003 avatar Nov 24 '21 10:11 manojkumawat003

Thanks a lot for your precious help @manojkumawat003 !!! It worked for us, you allowed us to make app releases again :+1: :1st_place_medal:

RomainTex avatar Nov 24 '21 13:11 RomainTex

Thanks a lot for your precious help @manojkumawat003 !!! It worked for us, you allowed us to make app releases again 👍 🥇

its my pleasure.!!

manojkumawat003 avatar Nov 26 '21 10:11 manojkumawat003

@manojkumawat003 , Your trick worked!. Thanks.

sureshpodeti avatar Dec 04 '21 10:12 sureshpodeti

if you still did not get the issue resolved then follow these instructions, it helped me-

  1. go to nativescript-permissions in node_modules
  2. rename or delete permission.js file
  3. now go to @master.technology/permission folder
  4. copy permissions.android.js and permissions.ios.js file
  5. paste these files to nativescript-permissions folder 6 Capture .

I did not have any @master.technology/nativescript folder

nidheeshfullstack avatar Apr 25 '22 14:04 nidheeshfullstack

if you still did not get the issue resolved then follow these instructions, it helped me-

  1. go to nativescript-permissions in node_modules
  2. rename or delete permission.js file
  3. now go to @master.technology/permission folder
  4. copy permissions.android.js and permissions.ios.js file
  5. paste these files to nativescript-permissions folder 6 Capture .

This worked for me, thank you for posting

vamsiitengineer avatar Apr 25 '22 16:04 vamsiitengineer

This process worked for me, Thanks a lot.

nidheeshfullstack avatar Apr 26 '22 12:04 nidheeshfullstack

if you still did not get the issue resolved then follow these instructions -

  1. go to nativescript-permissions in node_modules
  2. rename or delete permission.js file
  3. now go to @master.technology/permission folder
  4. copy permissions.android.js and permissions.ios.js file
  5. paste these files to nativescript-permissions folder 6 Capture .

After do this process i have faced this issue.

image

nidheeshfullstack avatar Apr 28 '22 09:04 nidheeshfullstack

What can i do for that @manojkumawat003 can you suggest anything

nidheeshfullstack avatar Apr 28 '22 09:04 nidheeshfullstack

if you still did not get the issue resolved then follow these instructions -

  1. go to nativescript-permissions in node_modules
  2. rename or delete permission.js file
  3. now go to @master.technology/permission folder
  4. copy permissions.android.js and permissions.ios.js file
  5. paste these files to nativescript-permissions folder 6 Capture .

After do this process i have faced this issue.

image

I am also faced this same issue @nidheeshfullstack @manojkumawat003 @alexziskind1

selvanathan123 avatar Apr 28 '22 09:04 selvanathan123

Manually editing dependencies downloaded into the node_modules folder isn't a great solution. It's not going to work with my CI/CD workflow :( I'm going to keep looking for a work around

DanLatimer avatar May 10 '22 20:05 DanLatimer

Can someone upload a test project that exhibits this behavior, my tests all work fine so I'm at a loss as to why it is having issues for some of you.

NathanaelA avatar May 10 '22 20:05 NathanaelA

Acknowledged Regards, Thank you for reading this mail, looking forward to hear from you, *Selvanathan * | Software Developer | Twilight Softwares | | M: +91 - 7010739842 | Skype: Selvanathan!! |

On Wed, May 11, 2022 at 2:03 AM Nathanael Anderson @.***> wrote:

Can someone upload a test project that exhibits this behavior, my tests all work fine so I'm at a loss as to why it is having issues for some of you.

— Reply to this email directly, view it on GitHub https://github.com/NathanaelA/nativescript-permissions/issues/49#issuecomment-1122833973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV7APA2IM24FKF4I72IEJSLVJLB2VANCNFSM5HHLIPVA . You are receiving this because you commented.Message ID: @.***>

selvanathan123 avatar May 11 '22 05:05 selvanathan123

@NathanaelA here's a repo that reproduces the error, just check out the repo, you can use the latest nativescript cli (currently 8.2.3) and run ns debug android

https://github.com/DanLatimer/nativescript-permissions-error

To create this repo I downgraded my nativescript cli to 6.5.1 then created a 6.5.1 application, then followed the instructions here, then upgraded my nativescript cli back to latest and tried to run the app

DanLatimer avatar May 11 '22 13:05 DanLatimer