Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

prompt dependency breaking tns builds and a possible solution #211

Closed
hdeshev opened this issue Nov 17, 2016 · 2 comments
Closed

prompt dependency breaking tns builds and a possible solution #211

hdeshev opened this issue Nov 17, 2016 · 2 comments
Milestone

Comments

@hdeshev
Copy link
Contributor

hdeshev commented Nov 17, 2016

Hi,

I just added nativescript-plugin-firebase to an app and my build started breaking with the following error

~/t/fb-test $ tns build android
Executing before-prepare hook from /home/local/TELERIK/hdeshev/tmp/fb-test/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /home/local/TELERIK/hdeshev/tmp/fb-test/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.0.10
shell.js: internal error
Error: EEXIST: file already exists, symlink '../mkdirp/bin/cmd.js' -> '/home/local/TELERIK/hdeshev/tmp/fb-test/platforms/android/src/main/assets/app/tns_modules/nativescript-plugin-firebase/node_modules/prompt/node_modules/utile/node_modules/.bin/mkdirp'
    at Error (native)
    at Object.fs.symlinkSync (fs.js:1054:18)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:76:10)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
    at /home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:183:9
    at Array.forEach (native)
    at Object._cp (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:157:11)
    at Object.cp (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/node_modules/shelljs/src/common.js:186:23)
    at TnsModulesCopy.copyDependencyDir (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:36:21)
    at TnsModulesCopy.copyModules (/home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:16:18)
    at /home/local/TELERIK/hdeshev/.n/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-builder.js:129:32

This seems to be caused by nativescript-cli trying to copy the prompt "dependency" to the device output folder, and failing when it tries to update executable symlinks. We have a number of issues here culminating in that problem:

  1. prompt needing to be a dependency, while it should really be a dev dependency. It is needed only by the postinstall script, but if it is a dev dependency, npm would not download it to a project.
  2. tns copying more files than it needs to. I'll open a separate issue about skipping executable symlinks.

nativescript-telerik-ui had a similar problem and they chose to get rid of the prompt dependency by bundling it in their postinstall script. I can open a PR that does the same for nativescript-plugin-firebase.

In addition I'll open issues on nativescript-cli that will prevent copying symlinks and allow plugin authors to prevent their postinstall scripts from being copied to mobile devices by providing a way to exclude certain files from device builds.

My question for @EddyVerbruggen here is whether you'll consider a PR implementing a webpack-based workflow for the postinstall script that will solve the immediate problem.

@EddyVerbruggen
Copy link
Owner

Hi @hdeshev! Thanks for those suggestions. I wouldn't mind having an inlined prompt dependency like nativecsript-telerik-ui does.

@EddyVerbruggen
Copy link
Owner

closed by PR #213

@EddyVerbruggen EddyVerbruggen added this to the 3.8.0 milestone Nov 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants