nativescript-permissions
nativescript-permissions copied to clipboard
Can't resolve '@master.technology/permissions' in version 1.3.12
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!
Can you tell me:
- NativeScript version (ns --version)
- What version of typescript you are using.
- What version of node & npm you are using.
- If there is a @master.technology/permissions folder in either the root
node_modules/
or innode_modules/nativescript-permissions/node_modules
Yeah no problem!
- NativeScript version (ns --version)
8.0.1
- What version of typescript you are using.
3.9.7
- What version of node & npm you are using.
node - v11.3.0 npm - 6.4.1
- If there is a @master.technology/permissions folder in either the root
node_modules/
or innode_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!
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
.
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
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:
- You can for sure fix this by updating all references to use
@master.technology/permissions
instead of the oldnativescript-permissions
name. - You can update your webpack rules to rewrite (
nativescript-permissions
to@master.technology/permissions
) - 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:
- What version of Node & NPM
- What version of NativeScript CLI you are using (
tns --version
) - Your apps
package.json
file.
Experiencing the same issue. Stripped 3. to only contain nativescript modules.
- 14
- 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 , @alexziskind1 , @tylerablake - are any of you by any chance using the NS/Angular code sharing Schematics?
I'm using NS + Angular but not code sharing schematics
@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 - 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:
- 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).
- 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.
Hi, i have the same issue as above. I'm using code sharing too.
- node : 12.19 + npm 6.4.18
- 8.1.3 (tried in 6.5 too) we are using a NS 6 project.
- "@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 -
- Can you verify that you have a copy of the @master.technology/permissions in the
app/node_modules/nativescript-permissions/node_modules/[HERE]
- 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...
Thank you for you quick answer @NathanaelA
- 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.
- 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.
@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.
@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:
- tns create --ng titi
- tns plugin add nativescript-imagepicker
- 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;
}
}
- 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
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?
if you still did not get the issue resolved then follow these instructions -
- go to nativescript-permissions in node_modules
- rename or delete permission.js file
- now go to @master.technology/permission folder
- copy permissions.android.js and permissions.ios.js file
- paste these files to nativescript-permissions folder
6
.
Thanks a lot for your precious help @manojkumawat003 !!! It worked for us, you allowed us to make app releases again :+1: :1st_place_medal:
Thanks a lot for your precious help @manojkumawat003 !!! It worked for us, you allowed us to make app releases again 👍 🥇
its my pleasure.!!
@manojkumawat003 , Your trick worked!. Thanks.
if you still did not get the issue resolved then follow these instructions, it helped me-
- go to nativescript-permissions in node_modules
- rename or delete permission.js file
- now go to @master.technology/permission folder
- copy permissions.android.js and permissions.ios.js file
- paste these files to nativescript-permissions folder 6
.
I did not have any @master.technology/nativescript folder
if you still did not get the issue resolved then follow these instructions, it helped me-
- go to nativescript-permissions in node_modules
- rename or delete permission.js file
- now go to @master.technology/permission folder
- copy permissions.android.js and permissions.ios.js file
- paste these files to nativescript-permissions folder 6
.
This worked for me, thank you for posting
This process worked for me, Thanks a lot.
if you still did not get the issue resolved then follow these instructions -
- go to nativescript-permissions in node_modules
- rename or delete permission.js file
- now go to @master.technology/permission folder
- copy permissions.android.js and permissions.ios.js file
- paste these files to nativescript-permissions folder 6
.
After do this process i have faced this issue.
What can i do for that @manojkumawat003 can you suggest anything
if you still did not get the issue resolved then follow these instructions -
- go to nativescript-permissions in node_modules
- rename or delete permission.js file
- now go to @master.technology/permission folder
- copy permissions.android.js and permissions.ios.js file
- paste these files to nativescript-permissions folder 6
.
After do this process i have faced this issue.
I am also faced this same issue @nidheeshfullstack @manojkumawat003 @alexziskind1
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
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.
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: @.***>
@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