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

EACCES (Permission denied) when livesync Angular projects on Samsung devices

Open NickIliev opened this issue 9 years ago • 28 comments

From @S4M37 on February 3, 2017 14:27

I'm using NativeScript 2.5.0 with Angular2, using android platform with building tool 25.0.2, I'm testing on a device, and tns doctor no issues are found. So my problem is when running 'tns run android' the app is launched but no changes are applied, here is the log

Project successfully prepared (android) Transferring project files... Unable to sync files. Error is: ENOENT: no such file or directory, stat 'C:\Users\S4M37\Desktop\CrossPlatform\project\platforms\android\src\main\assets\app\modules\feed\item\feed.item.css___jb_tm p___' 02-03 15:16:18.512 5693 5693 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.nativescript.project/sync/tns_modules/rxjs/src/MiscJSDoc.ts 02-03 15:16:18.532 5335 5335 E audit : type=1400 msg=audit(1486131378.512:526786): avc: denied { unlink } for pid=5693 comm="tivescript.project" name="MiscJSDoc.ts" dev="dm-1" ino=335142 s context=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 02-03 15:16:18.562 5693 5693 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.nativescript.project/sync/tns_modules/rxjs/src/observable/dom/MiscJSDoc.ts 02-03 15:16:18.582 5335 5335 E audit : type=1400 msg=audit(1486131378.562:526982): avc: denied { unlink } for pid=5693 comm="tivescript.project" name="MiscJSDoc.ts" dev="dm-1" ino=335340 s context=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 JS: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode. 02-03 15:16:22.322 5693 5693 W ExifInterface: at com.tns.Runtime.callJSMethodNative(Native Method)

Copied from original issue: NativeScript/NativeScript#3569

NickIliev avatar Feb 03 '17 14:02 NickIliev

Also experiencing this error after updating to 2.5

danieljohngomez avatar Feb 05 '17 10:02 danieljohngomez

Had the same problem. Removing and adding again the android platform fixed the error, but now the app crashes for the tiniest UI changes without any error. I have to restart the app every time to get it working again.

ghost avatar Feb 05 '17 17:02 ghost

I had already tried removing the platform and re-adding it, but the problem still persisting.

S4M37 avatar Feb 06 '17 16:02 S4M37

Same here ! Problem also occured without using Angular.

rhanb avatar Feb 07 '17 10:02 rhanb

+1

RaphaelJenni avatar Feb 08 '17 11:02 RaphaelJenni

@alpinparker @S4M37 @rhanbIT @RaphaelJenni, can you provide steps to reproduce. What devices are you using?

Plamen5kov avatar Feb 08 '17 13:02 Plamen5kov

Can't reproduce it. Happens from time to time and then I have to restart the app. (tns run android) I'm using the android emulator. Haven't tried it on a physical device.

RaphaelJenni avatar Feb 08 '17 13:02 RaphaelJenni

Happened again:

Transferring project files...
Unable to sync files. Error is: ENOENT: no such file or directory, stat 'C:\_Projects\_NativeScript\project\platforms\android\src\main\assets\app\tns_modules\sharp\build\Release\obj\libvips-cpp\libvips-cpp.tlog\link-VCTIP.delete.93.tlog'

The folder sharp doesn't exist. Is sharp a necessary import? Added it now to the dependencies ("sharp": "^0.16.2"). I will keep you updated if it changes anything.

RaphaelJenni avatar Feb 08 '17 13:02 RaphaelJenni

I'm testing on Samsung Galaxy S7, android 6.0.1 I run tns run android, it builds the app, installs it on device then after each changes the app is refreshed but without synchronizing files with the same error mentioned in the issue, to synchronize files I stop the processes and re-run tns run android.

S4M37 avatar Feb 08 '17 14:02 S4M37

same issue , testing on genymotion Google Nexus 7 API 22 emulator .

AbbeYassine avatar Feb 08 '17 14:02 AbbeYassine

same here, using Samsung Note 7 device.

NativeScript Debugger started

[NSDebugAdapter] Ready to attach to application on 40000 [NSDebugAdapter] Connection to target application established on 40000 Executing before-watch hook from c:\SORTE\src\SORTE.Mobile\hooks\before-watch\nativescript-dev-typescript.js Found peer TypeScript 2.1.5

02-10 12:30:28.051 22470 22470 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/com.sortenasvendas.app/sync/tns_modules/lodash/fp/toJSON.js

02-10 12:30:28.091 6849 6849 E audit : type=1400 msg=audit(1486737028.051:404395): avc: denied { unlink } for pid=22470 comm="tenasvendas.app" name="toJSON.js" dev="sda17" ino=397221 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0

02-10 12:30:29.251 6849 6849 E audit : type=1400 msg=audit(1486737029.221:407491): avc: denied { unlink } for pid=22470 comm="tenasvendas.app" name="MiscJSDoc.ts" dev="sda17" ino=400321 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0

02-10 12:30:30.121 22470 22470 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/com.sortenasvendas.app/sync/tns_modules/rxjs/src/MiscJSDoc.ts

02-10 12:30:30.151 6849 6849 E audit : type=1400 msg=audit(1486737030.121:409914): avc: denied { unlink } for pid=22470 comm="tenasvendas.app" name="MiscJSDoc.ts" dev="sda17" ino=402740 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0

02-10 12:30:30.181 22470 22470 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/com.sortenasvendas.app/sync/tns_modules/rxjs/src/observable/dom/MiscJSDoc.ts

02-10 12:30:30.221 6849 6849 E audit : type=1400 msg=audit(1486737030.181:410108): avc: denied { unlink } for pid=22470 comm="tenasvendas.app" name="MiscJSDoc.ts" dev="sda17" ino=402936 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 JS: Firebase.init done

smarza avatar Feb 10 '17 14:02 smarza

Hey guys, The issue reported by @S4M37 is in fact two separate issues. The first one: Unable to sync files. Error is: ENOENT: no such file or directory, stat 'C:\Users\S4M37\Desktop\CrossPlatform\project\platforms\android\src\main\assets\app\modules\feed\item\feed.item.css___jb_tm p___' should be resolved with our incoming 2.5.1 release.

The other one: 02-03 15:16:18.562 5693 5693 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.nativescript.project/sync/tns_modules/rxjs/src/observable/dom/MiscJSDoc.ts is something specific for some devices, I believe mostly Samsung ones. I'm still unable to reproduce it on my side, so most probably we'll release 2.5.1 without fix for this. Once we reproduce the problem, we'll provide a fix as soon as possible. In order to help us, can you please try reproducing the EACCESS error with tns run android --log trace and send us the output of the command when the error happened. After that, try executing the following:

$ adb shell -s <device id>
$ cd /data/local/tmp/
$ ls -la
$ cd <app id> (for example `cd org.nativescript.project`)
$ ls -al
$ ls -al sync

and send us the output of all these commands. This will help us to detect the permissions of the files and to understand what migth cause this issue.

Thanks in advance for your help!

rosen-vladimirov avatar Feb 15 '17 06:02 rosen-vladimirov

Hi there , am already signed up on Github and I tried to run those commands on the Github Command Line Interface ,but not able to know how to install the nativescript cli. Regards, Palak Grover

On Sat, Feb 18, 2017 at 2:18 PM, Angel Tsvetkov [email protected] wrote:

Hi Guys, In regards of the second error I think I figured out why this happens. In my AndroidManifest.xml file in my NativeScript project the android:minSdkVersion="17". There is a user permission for write external storage:

According to Android documentation WRITE_EXTERNAL_STORAGE starting in API level 19 is not required to read/write files in your application-specific directories (documentation https://developer.android.com/reference/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE). My test device is Samsung Galaxy S5 with Android 6.0.1 (API 23). I think that the issue comes when you request user permission WRITE_EXTERNAL_STORAGE on Android API > 18. The solution I found is to set android:maxSdkVersion="18" attribute to WRITE_EXTERNAL_STORAGE user-permission (documentation https://developer.android.com/guide/topics/manifest/uses-permission-element.html) so it looks like:

Don't forget to remove platform (tns platform remove android) and then re-run your app.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NativeScript/nativescript-cli/issues/2485#issuecomment-280832069, or mute the thread https://github.com/notifications/unsubscribe-auth/AYiZ-9Rjcl99s8GWkfqY5xYzMIOcDilNks5rdrBqgaJpZM4L2anI .

ghost avatar Feb 18 '17 10:02 ghost

Hey everyone, We've released NativeScript 2.5.1, can you give it a try and see if it resolves your issues? In order to update your CLI's installation, please execute:

$ npm install -g nativescript@latest

I'm looking forward to hearing from you.

rosen-vladimirov avatar Feb 18 '17 11:02 rosen-vladimirov

Thx, when updating to nativescript 2.5.1 the sync file issue is resolved for me. And thx for @Palak5034 too because his solution resolves the EACCES issues.

S4M37 avatar Feb 21 '17 00:02 S4M37

Hey @S4M37 , can you give some information how did you resolve the EACCESS issue, so other users reading this thread will be able to find the solution as well.

rosen-vladimirov avatar Feb 21 '17 07:02 rosen-vladimirov

I resolved it by editing the AndroidManifest.xml of the App_resources, by excluding the permission check for Android Api >18 with : <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/> according to @Palak5034 comment on this issue

S4M37 avatar Feb 21 '17 10:02 S4M37

Fix the issue for me on Linux :smile:

rhanb avatar Feb 21 '17 14:02 rhanb

Windows, CLI 2.5.2

tns run android --log trace
...
Successfully synced application org.test.app on device 32042064931e22df.

BeforeHookName for command watch is before-watch
Executing before-watch hook from C:\projects\Test\hooks\before-watch\nativescript-dev-typescript.js
Executing before-watch hook at location C:\projects\Test\hooks\before-watch\nativescript-dev-typescript.js in-process
Validating before-watch arguments.
Found peer TypeScript 2.1.6
C:\Program Files\nodejs\node.exe --max_old_space_size=4096 C:\projects\Test\node_modules\typescript\lib\tsc.js --project C:\projects\Test --watch --inlineSourceMap --inlineSources
Hook promises to signal completion
13:53:23 - Compilation complete. Watching for file changes.

Hook completed
03-17 13:53:27.109  3936  3936 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.test.app/sync/tns_modules/nativescript-angular/node_modules/rxjs/src/MiscJSDoc.ts
03-17 13:53:27.274  3487  3487 E audit   : type=1400 msg=audit(1489751607.109:948223): avc:  denied  { unlink } for  pid=3936 comm="org.test.app" name="MiscJSDoc.ts" dev="mmcblk0p21" ino=335337 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file
03-17 13:53:27.279  3487  3487 E audit   : type=1302 msg=audit(1489751607.109:948223): item=1 name="/data/local/tmp/org.test.app/sync/tns_modules/nativescript-angular/node_modules/rxjs/src/MiscJSDoc.ts" inode=335337 dev=103:0d mode=0100666 ouid=2000 ogid=2000 rdev=00:00 obj=u:object_r:shell_data_file:s0
03-17 13:53:27.824  3936  3936 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.test.app/sync/tns_modules/nativescript-angular/node_modules/rxjs/src/observable/dom/MiscJSDoc.ts
03-17 13:53:28.004  3487  3487 E audit   : type=1400 msg=audit(1489751607.819:948416): avc:  denied  { unlink } for  pid=3936 comm="org.test.app" name="MiscJSDoc.ts" dev="mmcblk0p21" ino=335532 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file
03-17 13:53:28.009  3487  3487 E audit   : type=1302 msg=audit(1489751607.819:948416): item=1 name="/data/local/tmp/org.test.app/sync/tns_modules/nativescript-angular/node_modules/rxjs/src/observable/dom/MiscJSDoc.ts" inode=335532 dev=103:0d mode=0100666 ouid=2000 ogid=2000 rdev=00:00 obj=u:object_r:shell_data_file:s0
03-17 13:53:34.879  3936  3936 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.test.app/sync/tns_modules/rxjs/src/MiscJSDoc.ts
03-17 13:53:35.094  3487  3487 E audit   : type=1400 msg=audit(1489751614.869:949932): avc:  denied  { unlink } for  pid=3936 comm="org.test.app" name="MiscJSDoc.ts" dev="mmcblk0p21" ino=337866 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file
03-17 13:53:35.099  3487  3487 E audit   : type=1302 msg=audit(1489751614.869:949932): item=1 name="/data/local/tmp/org.test.app/sync/tns_modules/rxjs/src/MiscJSDoc.ts" inode=337866 dev=103:0d mode=0100666 ouid=2000 ogid=2000 rdev=00:00 obj=u:object_r:shell_data_file:s0
03-17 13:53:35.719  3936  3936 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/org.test.app/sync/tns_modules/rxjs/src/observable/dom/MiscJSDoc.ts
03-17 13:53:35.974  3487  3487 E audit   : type=1400 msg=audit(1489751615.714:950125): avc:  denied  { unlink } for  pid=3936 comm="org.test.app" name="MiscJSDoc.ts" dev="mmcblk0p21" ino=338061 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=file
03-17 13:53:35.979  3487  3487 E audit   : type=1302 msg=audit(1489751615.714:950125): item=1 name="/data/local/tmp/org.test.app/sync/tns_modules/rxjs/src/observable/dom/MiscJSDoc.ts" inode=338061 dev=103:0d mode=0100666 ouid=2000 ogid=2000 rdev=00:00 obj=u:object_r:shell_data_file:s0
...

Afterwards can't get past this one:

adb shell -s 32042064931e22df

/system/bin/sh: /system/bin/sh: - : unknown option

dxshindeo avatar Mar 17 '17 12:03 dxshindeo

I can report the same issue. I am running into it now:

AfterHookName for command livesync is after-livesync
03-19 08:26:40.274 19346 19346 W System.err: remove failed: EACCES (Permission denied) : /data/local/tmp/com.pame.payroll/sync/tns_modules/rxjs/src/MiscJSDoc.ts

I can't seem to get around it. I am running and building on Windows 10.

jwuliger avatar Mar 19 '17 12:03 jwuliger