Skip to content

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

@vbansal-bb

Description

@vbansal-bb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions