question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source and destination must not be the same.

See original GitHub issue

Bug Report

Problem

Since cordova-android 8.0.0 we have build problems. In most of cases we got the error “An error occurred while running subprocess cordova.” and the last line “Source and destination must not be the same”. Sometimes, the build is ok. - We always check out the git repository of the app. (hard clean)

What is expected to happen?

Build successfully.

What does actually happen?

Build failed.

Information

This error is not 100% reprocable. But about 80%. I just updated Cordova-Android. I expecting the node plugin fa-extra. Maybe Cordova-Android uses this with wrong attributes?

Command or Code

ionic cordova build android --release --prod --generateSourceMap false But also ionic cordova build or cordova build.

Environment, Platform, Device / Version information

Ionic:
   ionic (Ionic CLI)  : 4.10.1
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:
   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : Cordova-Android 8.0.0

System:
   Android SDK Tools : 26.1.1 (C:\Users\jenkins\AppData\Local\Android\sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10

Log

Console log
------------------------------------------------------------------------------------
...
[INFO] Discovered plugin "cordova-plugin-email-composer" in config.xml. Adding it to the project
[INFO] Installing "cordova-plugin-email-composer" for android
[INFO] Subproject Path: CordovaLib
[INFO] Subproject Path: app
[INFO] Adding cordova-plugin-email-composer to package.json
[INFO] Saved plugin info for "cordova-plugin-email-composer" to config.xml
[INFO] Source and destination must not be the same.
[ERROR] [ERROR] An error occurred while running subprocess cordova.
[ERROR]
[ERROR]         cordova platform add android --save exited with exit code 1.
[ERROR]
[ERROR]         Re-running this command with the --verbose flag may provide more information.
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 1
[ERROR] npm ERR! testapp@1.2.3 build:release: `ionic cordova build android --release --prod --generateSourceMap false`
[ERROR] npm ERR! Exit status 1
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the testapp@1.2.3 build:release script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     C:\Users\jenkins\AppData\Roaming\npm-cache\_logs\2019-03-18T08_17_34_817Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  39:57 min
[INFO] Finished at: 2019-03-18T09:17:35+01:00
[INFO] ------------------------------------------------------------------------
Wait until Jenkins completes the data collection...
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:npm (npm build) on project my-project:
  Failed to run task: 'npm run build:release' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[JENKINS] Archiving C:\Jenkins\workspace\MYPROJECT\MYAPP\pom.xml to de.me.testapp.webclient/my-project/1.2.3/my-project-1.2.3.pom
Set build name.
New build name is '#317 1.2.3'
channel stopped
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
Finished: FAILURE
[END]

NPM Scripts
------------------------------------------------------------------------------------
"npm run build:release": "ionic cordova build android --release --prod --generateSourceMap false"

C:\Users\jenkins\AppData\Roaming\npm-cache\_logs\2019-03-18T08_17_34_817Z-debug.log
------------------------------------------------------------------------------------
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Jenkins\\workspace\\MYPROJECT\\MYAPP\\target\\node\\node.exe',
1 verbose cli   'C:\\Jenkins\\workspace\\MYPROJECT\\MYAPP\\target\\node\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build:release' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'prebuild:release', 'build:release', 'postbuild:release' ]
5 info lifecycle testapp@1.2.3~prebuild:release: testapp@1.2.3
6 info lifecycle testapp@1.2.3~build:release: testapp@1.2.3
7 verbose lifecycle testapp@1.2.3~build:release: unsafe-perm in lifecycle true
8 verbose lifecycle testapp@1.2.3~build:release: PATH:
  C:\Jenkins\workspace\MYPROJECT\MYAPP\target\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;
  C:\Jenkins\workspace\MYPROJECT\MYAPP\node_modules\.bin;
  C:\Jenkins\workspace\MYPROJECT\MYAPP\target\node;
  C:\Program Files (x86)\dev_tools\apache-maven-3.6.0/bin;
  C:\Program Files\Java\jdk1.8.0_192/bin;
  C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
  C:\ProgramData\Oracle\Java\javapath;
  C:\WINDOWS\system32;
  C:\WINDOWS;
  C:\WINDOWS\System32\Wbem;
  C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
  C:\Program Files\dotnet\;
  C:\TDM-GCC-64\bin;
  C:\PhantomJs\bin;
  C:\WINDOWS\System32\OpenSSH\;
  C:\Program Files\Git\cmd;
  C:\Program Files (x86)\WiX Toolset v3.11\bin\;
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\;
  C:\Program Files\nodejs\;
  C:\Users\jenkins\AppData\Local\Microsoft\WindowsApps;
  C:\Users\jenkins\AppData\Roaming\npm;
  C:\Users\jenkins\AppData\Local\Programs\Microsoft VS Code\bin;
  C:\Python27;
9 verbose lifecycle testapp@1.2.3~build:release: CWD: C:\Jenkins\workspace\MYPROJECT\MYAPP
10 silly lifecycle testapp@1.2.3~build:release: Args: [ '/d /s /c',
10 silly lifecycle   'ionic cordova build android --release --prod --generateSourceMap false' ]
11 silly lifecycle testapp@1.2.3~build:release: Returned: code: 1  signal: null
12 info lifecycle testapp@1.2.3~build:release: Failed to exec build:release script
13 verbose stack Error: testapp@1.2.3 build:release: `ionic cordova build android --release --prod --generateSourceMap false`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Jenkins\workspace\MYPROJECT\MYAPP\target\node\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Jenkins\workspace\MYPROJECT\MYAPP\target\node\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid testapp@1.2.3
15 verbose cwd C:\Jenkins\workspace\MYPROJECT\MYAPP
16 verbose Windows_NT 10.0.17134
17 verbose argv
  "C:\\Jenkins\\workspace\\MYPROJECT\\MYAPP\\target\\node\\node.exe"
  "C:\\Jenkins\\workspace\\MYPROJECT\\MYAPP\\target\\node\\node_modules\\npm\\bin\\npm-cli.js"
  "run"
  "build:release"
18 verbose node v10.15.3
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error testapp@1.2.3 build:release: `ionic cordova build android --release --prod --generateSourceMap false`
22 error Exit status 1
23 error Failed at the testapp@1.2.3 build:release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
Sagar-rrcommented, Jan 2, 2020

Hey, I was having same error “Source and destination must not be the same” My error was solved by Following Command

cordova clean android

3reactions
PeterHddcommented, Oct 8, 2019

No but didnt wanna add it because this is a company’s project, not mine personal. But here is the rest:

(node:11892) UnhandledPromiseRejectionWarning: Error: Source and destination must not be the same.
    at Object.checkPathsSync (D:\Peter\<project>\<project>\node_modules\fs-extra\lib\util\stat.js:92:11)
    at Object.copySync (D:\Peter\<project>\<project>\node_modules\fs-extra\lib\copy-sync\copy-sync.js:24:38)
    at updatePathWithStats (D:\Peter\<project>\<project>\node_modules\cordova-common\src\FileUpdater.js:103:24)
    at D:\Peter\<project>\<project>\node_modules\cordova-common\src\FileUpdater.js:298:19
    at Array.forEach (<anonymous>)
    at Object.mergeAndUpdateDir (D:\Peter\<project>\<project>\node_modules\cordova-common\src\FileUpdater.js:296:33)
    at updateWww (D:\Peter\<project>\<project>\platforms\android\cordova\lib\prepare.js:161:17)
    at Api.module.exports.prepare (D:\Peter\<project>\<project>\platforms\android\cordova\lib\prepare.js:60:19)
    at Api.prepare (D:\Peter\<project>\<project>\platforms\android\cordova\Api.js:175:45)
    at C:\Users\Peter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:106:36
Read more comments on GitHub >

github_iconTop Results From Across the Web

fs-extra: source and destination must not be the same. (cordova)
I don't know if this is the correct answer, but it could be a wrong setting in the cordova build.json (if you have...
Read more >
Error: Source and destination must not be the same (Windows ...
Error: Source and destination must not be the same (Windows as Virtual Machine). This public forum is for user-to-user discussions of PHPMaker.
Read more >
"source and destination must be different" error when copying ...
The obvious fix would be to just check that the files are not equal before performing the copy, but so far I haven't...
Read more >
[Bug] Cordova Build: Source and destination must not be the ...
[Bug] Cordova Build: Source and destination must not be the same · They uses the number type of the value. Not the big-integer....
Read more >
Fix error "Source and destination are same."
You are trying to save the recovered data on the same media from where you are recovering it. Please choose another location to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found