SystemError [ERR_FS_CP_EINVAL]: Invalid src or dest: cp returned EINVAL during command cordova platform add android
- Dominant language
- JavaScript
- Stars
- 967
- Forks
- 344
- Avg merge
- 8h 41m
- Merged PRs (30d)
- 9
Description
# 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 (cordova-lib@12.0.1)
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
Contributor guide
Research direction
Reproduce the failure with the listed cordova create, npm init, npm i jasmine, and cordova platform add android commands. Trace how the www directory and its www/node_modules/.bin symlink are copied into platforms/android/app/src/main/assets/www; done when platform addition succeeds with this symlink scenario and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, nodejs
- Domain
- cli, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100