Skip to content

CLI fails when preparing plugin with symlink on Mac #2242

Closed
@ivanbuhov

Description

@ivanbuhov

Modules copying fails on Mac if a non-dev plugin contains a symlink:

Executing before-prepare hook from /Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/EncryptedSampleApp/hooks/before-prepare/nativescript-dev-android-snapshot.js
shell.js: internal error
Error: EEXIST: file already exists, symlink '../mkdirp/bin/cmd.js' -> '/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/EncryptedSampleApp/platforms/ios/EncryptedSampleApp/app/tns_modules/nativescript-app-encryption/node_modules/nativescript-hook/node_modules/.bin/mkdirp'
    at Error (native)
    at Object.fs.symlinkSync (fs.js:1054:18)
    at cpdirSyncRecursive (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:76:10)
    at cpdirSyncRecursive (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:73:7)
    at cpdirSyncRecursive (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:73:7)
    at /Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:183:9
    at Array.forEach (native)
    at Object._cp (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/cp.js:157:11)
    at Object.cp (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/shelljs/src/common.js:186:23)
    at TnsModulesCopy.copyDependencyDir (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:42:21)
    at _loop_1 (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:17:20)
    at TnsModulesCopy.copyModules (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:31:13)
    at /Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/nativescript/lib/tools/node-modules/node-modules-builder.js:129:32
    at Function.settle (/Users/nsbuilduser/workspace/nativescript-app-encryption-stable/TestApp/node_modules/fibers/future.js:249:26)

To reproduce the issue:

  1. Create a blank app (on Mac)
  2. Add a plugin that contains a symlink file - tns plugin add {plugin-name}
  3. Build for android or ios twice - tns build ios/android. The second build should fail.

The issue is caused by a bug in shelljs which is fixed in shelljs@v0.7.0. A possible solution is to update the shelljs version to the latest available (currently v0.7.5).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions