EddyVerbruggen / nativescript-nodeify

Makes most npm packages compatible with NativeScript
MIT License
93 stars 27 forks source link

NativeScript-Vue support #53

Open TheTrunk opened 5 years ago

TheTrunk commented 5 years ago

I am creating NativeScript-Vue application and I am struggeling to use nativescript-nodeify plugin. Is there a documented way of using it in nativescript-vue template?

Eligioo commented 5 years ago

No solution so far? I stumble on: Error is: Cannot find module '[...]\platforms\android\app\src\main\assets\app\tns_modules\nativescript-nodeify\patch-npm-packages.js'.

https://kion.me/using-nativescript-nodeify-with-nativescript-vue/ Found this article. Haven't tried it myself tho.

Edit: Add article

racknoris commented 5 years ago

@Eligioo DId you manage to solve this?

Eligioo commented 5 years ago

@racknoris It's been 2 months ago so I don't really remember correctly anymore. But I think I did solve it in the end by copying the not-found module(s) from the source folder to the actual target folder. It's deep nested somewhere in the Gradle folder. It's a folder that contains all the other modules that are actually copied correctly for transferring to the phone.

racknoris commented 5 years ago

I copied the nativescript-nodeify from my node_modules to platforms\android\app\src\main\assets\app, and the compilation worked but I encountered some weird runtime errors I haven't seen before (using angular btw)

msaelices commented 5 years ago

The problem is related to webpack. Please see this issue #35

There is a workaround here: https://github.com/EddyVerbruggen/nativescript-nodeify/issues/35#issuecomment-421807752

aiya000 commented 5 years ago

I have a same (???) issue on my nativescript-vue project :sob: (https://github.com/EddyVerbruggen/nativescript-nodeify/issues/35#issuecomment-421807752 workaround couldn't fix this...)

$ tns plugin add nativescript-nodeify
$ npm install aws-sdk node-uuid @types/node --save
$ tns run android --bundle

...

ERROR in ../node_modules/aws-sdk/lib/credentials/process_credentials.js
Module not found: Error: Can't resolve 'child_process' in '/path/to/weekend-school-for-kids/node_modules/aws-sdk/lib/credentials'
 @ ../node_modules/aws-sdk/lib/credentials/process_credentials.js 3:11-35
 @ ../node_modules/aws-sdk/lib/node_loader.js
 @ ../node_modules/aws-sdk/lib/aws.js
 @ ./control/Instructions.ts
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue
 @ ./main.ts

ERROR in ../node_modules/aws-sdk/lib/publisher/index.js
Module not found: Error: Can't resolve 'dgram' in '/path/to/weekend-school-for-kids/node_modules/aws-sdk/lib/publisher'
 @ ../node_modules/aws-sdk/lib/publisher/index.js 3:12-28
 @ ../node_modules/aws-sdk/lib/node_loader.js
 @ ../node_modules/aws-sdk/lib/aws.js
 @ ./control/Instructions.ts
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue
 @ ./main.ts

ERROR in ../node_modules/xml2js/lib/parser.js
Module not found: Error: Can't resolve 'timers' in '/path/to/weekend-school-for-kids/node_modules/xml2js/lib'
 @ ../node_modules/xml2js/lib/parser.js 38:17-34
 @ ../node_modules/xml2js/lib/xml2js.js
 @ ../node_modules/aws-sdk/lib/xml/node_parser.js
 @ ../node_modules/aws-sdk/lib/node_loader.js
 @ ../node_modules/aws-sdk/lib/aws.js
 @ ./control/Instructions.ts
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue?vue&type=script&lang=ts&
 @ ./components/App/NotingScreen.vue
 @ ../node_modules/ts-loader??ref--3!../node_modules/vue-loader/lib??vue-loader-options!./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue?vue&type=script&lang=ts&
 @ ./components/App.vue
 @ ./main.ts
Webpack compilation complete. Watching for file changes.
Webpack build done!
Copying template files...
Platform android successfully added. v5.0.0
Preparing project...

...