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

BUILD SUCCESSFUL / The system failed to delete the package for an unspecified reason.

Open patrickhofer opened this issue 10 years ago • 4 comments

When i run tns run android i get a successful build on windows and the app starts on the device, but i get the error

BUILD SUCCESSFUL

Total time: 1 mins 0.367 secs
Project successfully built
The system failed to delete the package for an unspecified reason.
Successfully deployed on device with identifier 'LGH815e15'.

on in the cli and this on the device:


java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 
Error calling module function 

Error: com.tns.NativeScriptException: Failed to find module: "timers", relative to: /app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:220)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:241)
    com.tns.Runtime.run(Runtime.java:235)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4795)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5525)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/tns_modules/zone.js/dist/zone-node.js', line: 670, column: 14
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/tns_modules/nativescript-angular/application.js', line: 2, column: 1
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/main.js', line: 3, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4798)
    at android.app.ActivityThread.access$1600(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5525)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: com.tns.NativeScriptException: 
Error calling module function 

Error: com.tns.NativeScriptException: Failed to find module: "timers", relative to: /app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:220)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:241)
    com.tns.Runtime.run(Runtime.java:235)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4795)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5525)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/tns_modules/zone.js/dist/zone-node.js', line: 670, column: 14
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/tns_modules/nativescript-angular/application.js', line: 2, column: 1
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.beer/files/app/main.js', line: 3, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


    at com.tns.Runtime.runModule(Native Method)
    at com.tns.Runtime.runModule(Runtime.java:241)
    at com.tns.Runtime.run(Runtime.java:235)
    at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4795)
    ... 8 more

Then when i run tns livesync android --watch i get this error message:

Processing node_modules failed. Error: rm: could not remove file (code EBUSY): C:\Users\p-hof\DEV\beer\platforms\android\src\main\assets\app\tns_modules\tns-core-modules/ui/builder/component-builder.js
rm: could not remove directory (code ENOTEMPTY): C:\Users\p-hof\DEV\beer\platforms\android\src\main\assets\app\tns_modules\tns-core-modules/ui/builder
rm: could not remove directory (code ENOTEMPTY): C:\Users\p-hof\DEV\beer\platforms\android\src\main\assets\app\tns_modules\tns-core-modules/ui
rm: could not remove directory (code ENOTEMPTY): C:\Users\p-hof\DEV\beer\platforms\android\src\main\assets\app\tns_modules\tns-core-modules


I'm running windows 10 my tns version is 2.2.1

Any help much appreciated!

patrickhofer avatar Sep 13 '16 20:09 patrickhofer

Hi @patrickhofer

Your issue is most probably related to this one. The fix is coming with next release. Meanwhile use the following workaround:

Open your project package.json Change the following line:

  "zone.js": "^0.6.17"

to this:

  "zone.js": "0.6.17"

After the package.json is changed, remove node_modules and platforms folders and rebuild your app.

We are working on a fix to allow version 0.6.21 to build. Let me know if that solved your issue and if you need further assistance.

NickIliev avatar Sep 14 '16 05:09 NickIliev

I just tried the above in both package.json files and got this:

[email protected] postinstall D:\Repos\CADLearning\Mobile\Cadlearning.mobile\node_modules\nativescript-angular node postinstall.js

npm WARN peerDependencies The peer dependency zone.js@^0.6.21 included from @angular/core will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly. Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: EPERM: operation not permitted, unlink 'D:\Repos\CADLearning\Mobile\Cadlearning.mobile\node_modules\nativescript-dev-sass\node_modules\node-sass\vendor\win32-x64-48\binding.node'

JohnGalt1717 avatar Nov 08 '16 19:11 JohnGalt1717

The issue is happen not only for zone.js, but also for other plugin (e.g. nativescript-social-share) when adding new plugin. After delete node_modules and platforms folders then rebuild it will be OK. But I think the team should fix the command tns run to make it more stable. Thank you.

vnheros avatar Nov 27 '16 07:11 vnheros

Just encountered this as well... kinda frustrating, but glad there is some sort of workaround

sitefinitysteve avatar Dec 07 '16 20:12 sitefinitysteve