8

When I am tried to build apache cordova application in Visual Studio 2015 Preview I am experiencing following error.

npm install error : error : spawn ENOENT

But in Command prompt if i use

npm -v

Its returning

2.1.9

But when visual studio trying to install npm I am getting error.

Can any one help me on this?

Thanks.

Hi all,

After done the steps told by Ellen. Visual Studio reported New Error message

1>Task "MdaVsCli" (TaskId:17)
1>  Task Parameter:VsCliPath= C:\Users\MyName\AppData\Roaming\npm\node_modules\vs-mda\vs-cli.cmd (TaskId:17)
1>  Task Parameter:Platform=Android (TaskId:17)
1>  Task Parameter:ProjectDir=. (TaskId:17)
1>  Task Parameter:Configuration=Debug (TaskId:17)
1>  Task Parameter:ProjectName=BlankCordovaApp21 (TaskId:17)
1>  Task Parameter:Language=en-US (TaskId:17)
1>  Task Parameter:BuildTarget=RippleNexus (TaskId:17)
1>  The system cannot find the path specified. (TaskId:17)
1>Done executing task "MdaVsCli" -- FAILED. (TaskId:17)

The following are the message after i had installed npm.

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\xxl33
z1o.sqb\packages\vs-mda>npm -g install
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.10.33","npm":"2.1.9"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.10.33","npm":"2.1.9"})
C:\usr\local\vs-cli -> C:\usr\local\node_modules\vs-mda\vs-cli.cmd
vs-mda@0.1.70 C:\usr\local\node_modules\vs-mda
├── rimraf@2.2.6
├── ncp@0.5.1
├── q@1.0.1
├── mkdirp@0.3.5
├── adm-zip@0.4.4
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
├── fstream@0.1.28 (inherits@2.0.1, graceful-fs@3.0.4)
├── tar@0.1.20 (inherits@2.0.1, block-stream@0.0.7)
├── elementtree@0.1.6 (sax@0.3.5)
├── request@2.36.0 (json-stringify-safe@5.0.0, tunnel-agent@0.4.0, forever-agent
@0.5.2, qs@0.6.6, aws-sign2@0.5.0, oauth-sign@0.3.0, mime@1.2.11, node-uuid@1.4.
1, tough-cookie@0.12.1, form-data@0.1.4, hawk@1.0.0, http-signature@0.10.0)
├── ripple-emulator@0.9.24 (connect-xcors@0.5.2, colors@0.6.0-1, open@0.0.3, acc
ounting@0.4.1, request@2.12.0, moment@1.7.2, express@3.1.0)
├── cordova@4.0.0 (q@0.9.7, underscore@1.4.4, nopt@2.2.1, cordova-lib@4.0.0)
└── plugman@0.22.4 (q@0.9.7, underscore@1.4.4, nopt@1.0.10, rc@0.3.0, cordova-li
b@0.21.6, npm@1.3.4)

I dont know why vs-cli looking in to wrong directory.

C:\usr\local\vs-cli

But the npm actually installed in the following directory

C:\Program Files\nodejs\node_modules\npm

Anyone help me on this.

Thanks

Ellen
  • 1,189
  • 7
  • 9
Gowtham
  • 395
  • 4
  • 13
  • 1
    To help diagnose this issue better, it would be useful to know if you previously had CTP2.0 installed to build Cordova apps in VS 2013 Update 3? – Ellen Nov 25 '14 at 00:39
  • 1
    @Ellen. I have not installed CTP 2.0 before. But i reinstalled visual studio multiple times. Still i cant able to install npm. – Gowtham Nov 25 '14 at 00:51

2 Answers2

5

It would be helpful to see a more verbose build output. You can set your build output to diagnostic (Tools\Options\Projects and Solutions\Build and Run\MSBuild project build output verbosity).

Try clearing your Cordova Cache from within VS under Tools\Options\Tools for Apache Cordova\Cordova Tools. After you have done that, re-open your project and attempt a clean build.

If you are still encountering issues at that point, you can attempt to manually install vs-mda using node following the instructions below.

Look for the packages folder under your VS install folder which contains vs-mda (the path will be something like this below. Note that the name of the highlighted folder will be unique to your system).

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\wgy514he.01m*\packages\vs-mda
  • Note that wgy514he.01m will not be the exact folder name, but look for something like it that contains the packages folder.

Then from an admin command prompt, run the command below. Note that it’s necessary to give the explicit path to the vs-mda folder under the VS installation path when issuing the command.

npm –g install <full path to packages folder>\vs-mda

If this install was successful, you should then be able to build your Cordova project. Let me know if this unblocks you. If this wasn’t successful, please pass along the results of the npm install command.

Ellen
  • 1,189
  • 7
  • 9
  • Thanks for your valuable suggestion. can you help me on the error message posted above. – Gowtham Nov 25 '14 at 05:27
  • @Gowtham - it looks like npm has been configured to install to a different location from where our tooling expects. You can check by running "npm config get prefix". As indicated from the error message, VS expects npm packages to be located at C:\Users\MyName\AppData\Roaming\npm. Do you remember setting your npm install location, or maybe another tool you are running might have done this? The way to work around it would be to reset it by running "npm config set prefix" followed by the folder c:\Users\yourname\AppData\Roaming\npm – Ellen Nov 25 '14 at 23:02
  • I Can able to build and can able to see output in Nexus 5. But now the problem is different. I cant able to attach debugger. Error Message: Unable to attach system cannot find the path specified. Can help me? – Gowtham Dec 12 '14 at 17:49
  • Are you running a localized version of Visual Studio? Even if you have the ENU language pack installed, if it was installed after the Cordova Tools, we have seen cases of the debugger failing to attach. Let me know if this is the case for you. – Ellen Dec 12 '14 at 19:58
1

Had the exact same problem, caused by an unknown factor. Was working just fine yesterday and this morning.

Here's how I fixed it :

Steps 1-2 are from Ellen's answer,

  1. clearing your Cordova Cache from within VS under Tools\Options\Tools for Apache Cordova\Cordova Tools.

  2. Look for the packages folder under your VS install folder which contains vs-mda

  3. I copied that folder to the build's target folder (C:\Users\MyName\AppData\Roaming\npm\node_modules).

  4. Had a new error while building : 'node' is not recognized as an internal or an external command while using phonegap/cordova

  5. Followed the solution in the link ( add node as environement variable. )

  6. Reboot.

  7. Success build.

  8. Celebrate by drinking coffee while furiously deploying my 2 button's cordova app.

Note : I am using visual studio 2013 update 4. Win 7 os.

Community
  • 1
  • 1
Dave
  • 2,774
  • 4
  • 36
  • 52