Unable to build a simple Cordova app in Visual Studio? Here’s a possible fix…

It is not so often these days that support cases have a quick solution. With the wealth of forums and other channels for peer assistance, most straightforward issues get fixed before people call us. So it is a pleasant change when something turns out to be quickly fixable.

In this case, the customer was using the Apache Cordova tooling for Visual Studio. We’d confirmed they were using the latest version of this, which at the time was Update 6.

Even a simple app created from the provided template would not build.

The build log was showing this:

1>         npm ERR! code EJSONPARSE
1>         npm ERR! Failed to parse json
1>         npm ERR! Unexpected token '\u0000' at 1:1
1>         npm ERR!          npm ERR! ^

 

With quick input from the our team in Redmond that work on this it was clear the customer’s NPM cache had somehow got corrupted.

Suggestion was to clear the cache, by shutting down Visual Studio and deleting the contents of “C:\Users\[USERNAME]\AppData\Roaming\npm-cache”.

Happily, this fixed it.

HTH

Doug