Can't deploy Visual Studio Cordova app to iPhone using remote agent: CordovaModuleLoadError

2.3k views Asked by At

I am trying to deploy my Cordova app to my iPhone using Visual Studio 2015 RC by Remote Agent > Local Device. I have successfully installed, ran and connect the remote agent to my Visual Studio. According to this link, when I run Local Device, iTunes should pop up on my Windows PC and install the app to my iPhone:

https://msdn.microsoft.com/en-us/library/dn757056.aspx

New build request submitted:
/build/tasks?command=build&vcordova=4.3.0&cfg=debug&options=--device
{ 'accept-language': 'en-US',
  host: '192.168.0.9:3000',
  connection: 'keep-alive',
  'transfer-encoding': 'chunked' }
New build request submitted for cordovaVersion: 4.3.0; buildCommand: build; configuration: debug
Build will be executed under: /Users/JP/remote-builds/builds/3563
Saving build request payload to : /Users/JP/remote-builds/builds/3563
Saved upload to /Users/JP/remote-builds/builds/3563/upload_3563.tgz
Extracting /Users/JP/remote-builds/builds/3563/upload_3563.tgz to /Users/JP/remote-builds/builds/3563/cordovaApp...
POST /build/tasks?command=build&vcordova=4.3.0&cfg=debug&options=--device 202 5123ms - 487b
GET /build/tasks/3563 200 0ms - 487b
Extracted app contents from uploaded build request to /Users/JP/remote-builds/builds/3563/cordovaApp. Requesting build.
Taking 3563 as current build
Building cordova app CordovaApp2 at appDir /Users/JP/remote-builds/builds/3563/cordovaApp
Opened build log file /Users/JP/remote-builds/builds/3563/build.log
Done building 3563 : error CordovaModuleLoadError [ '4.3.0' ]
Done with currentBuild. Checking for next build in queue.
GET /build/tasks/3563 200 4ms - 142.31kb
GET /build/tasks/3563/log 200 1ms

Additionally, from Visual Studio I get the error:

EACCES, open '/Users/JP/.npm/_locks/cordova-46ce3f50013cb5f4.lock'  CordovaApp2 C:\Users\J\Documents\Visual Studio 2015\Projects\CordovaApp2\CordovaApp2\MDAVSCLI   1

Remote build error from the build server undefined: {1} CordovaApp2 C:\Users\J\Documents\Visual Studio 2015\Projects\CordovaApp2\CordovaApp2\MDAVSCLI   1

When running remote test:

$ vs-mda-remote test --device
Initializing self test for https
downloading cert for pin 360583
Downloading client cert for selftest from https://Jamess-Mac-mini.local:3000/certs/360583 to /Users/JP/remote-builds/selftest/selftest-client.pfx
pfxPath: /Users/JP/remote-builds/selftest/selftest-client.pfx
serverUrl: https://Jamess-Mac-mini.local:3000
buildUrl: https://Jamess-Mac-mini.local:3000/build/tasks?vcordova=4.3.0&cfg=release&command=build&options=--device
Response statusCode: 202
{ 'x-powered-by': 'Express',
  'content-type': 'application/json',
  'content-location': 'https://jamess-mac-mini.local:3000/build/tasks/3570',
  'content-length': '489',
  date: 'Tue, 09 Jun 2015 22:05:58 GMT',
  connection: 'close' }
Response: {
  "buildNumber": 3570,
  "status": "uploaded",
  "cordovaVersion": "4.3.0",
  "buildCommand": "build",
  "configuration": "release",
  "options": "--device",
  "buildDir": "/Users/JP/remote-builds/builds/3570",
  "serverDir": "/Users/JP/remote-builds",
  "submissionTime": "2015-06-09T22:05:58.691Z",
  "changeList": null,
  "tgzFilePath": "/Users/JP/remote-builds/builds/3570/upload_3570.tgz",
  "statusTime": "2015-06-09T22:05:58.763Z",
  "message": "Uploaded build request payload."
}
buildingUrl: https://Jamess-Mac-mini.local:3000/build/tasks?vcordova=4.3.0&cfg=release&command=build&options=--device
[1] Response:  {
  "buildNumber": 3570,
  "status": "error",
  "cordovaVersion": "4.3.0",
  "buildCommand": "build",
  "configuration": "release",
  "options": "--device",
  "buildDir": "/Users/JP/remote-builds/builds/3570",
  "serverDir": "/Users/JP/remote-builds",
  "submissionTime": "2015-06-09T22:05:58.691Z",
  "changeList": null,
  "tgzFilePath": "/Users/JP/remote-builds/builds/3570/upload_3570.tgz",
  "messageId": "CordovaModuleLoadError",
  "statusTime": "2015-06-09T22:05:59.752Z",
  "appDir": "/Users/JP/remote-builds/builds/3570/cordovaApp",
  "appName": "HelloCordova",
  "messageArgs": [
    "4.3.0"
  ]
}
1

There are 1 answers

0
Chuck Lantz On BEST ANSWER

You are likely encountering the following Known Issue. Basically there's a file somewhere in your npm cache that was added while running as an administrator (sudo). As a result, vs-mda-remote cannot access it. The commands below resolve that issue (and in fact this is what recent versions of npm do by default).


iOS Build Related Known Issues

After installing the latest version of vs-mda-remote package, you may need to run the following commands before you start up the remote agent. These commands ensure your user has permissions to the contents of the npm package cache in your home directory when using older versions of Node.js and npm. Newer versions of Node.js and npm will do this for you automatically.

sudo npm cache clear 
sudo chown -R `whoami` ~/.npm