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

SystemError [ERR_FS_CP_EINVAL]: Invalid src or dest: cp returned EINVAL during command cordova platform add android

Open vbansal-bb opened this issue 8 months ago • 3 comments

Bug Report

Problem

In certain scenario (when there are nodue modules in www folder having sym link) cordova platform add android command fails

What is expected to happen?

Cordova platfprm add android should work as expected.

What does actually happen?

it gives below error

Invalid src or dest: cp returned EINVAL (cannot copy /Users/vbansal/Documents/Cordova_Workspace/test/www/node_modules/glob/dist/esm/bin.mjs to a subdirectory of self /Users/vbansal/Documents/Cordova_Workspace/test/www/node_modules/glob/dist/esm/bin.mjs) /Users/vbansal/Documents/Cordova_Workspace/test/platforms/android/app/src/main/assets/www/node_modules/.bin/glob

Information

It seems it gets confused due to to sym link if there in node_modules If i delete www/node_modules/.bin then issues goes away.

Command or Code

Following are the steps to reproduce it 100%

cordova create test com.test.blank Testapp cd test/www && npm init --yes npm i jasmine cd .. cordova platform add android

Environment, Platform, Device

Mac OS Android

Version information

Cordova- 12.0.0 ([email protected])

Node JS: 18.x, 20.x ,22.x all facing same issue

Checklist

  • [x ] I searched for existing GitHub issues
  • [x ] I updated all Cordova tooling to most recent version
  • [ x] I included all the necessary information above

vbansal-bb avatar Apr 21 '25 11:04 vbansal-bb

I also guess that also this issue start appearing after fs-extra 11.3.0 release on 15 Jan. Could this change (https://github.com/jprichardson/node-fs-extra/pull/1045/files)be the root cause ?

@cordova team please see if you like to fix the issue

vbansal-bb avatar Apr 21 '25 11:04 vbansal-bb

@vbansal-bb Does this happen with cordova-android 14.0.0? fs-extra is no longer used in newer versions of the Android platform.

dpogue avatar Apr 22 '25 04:04 dpogue

@dpogue yes. Issue occurs with cordov android 14.0.0 as well

vbansal-bb avatar Apr 22 '25 09:04 vbansal-bb