Troubleshooting Angular application

Unofficial Content
This documentation is valid for:

This is a list of issues that could happen when you develop Angular applications with GeneXus, and instructions on how to solve them.

Problem 1

When running the Angular application from the GeneXus IDE or running an 'npm install' command, the following error may occur: 
npm ERR! Unexpected end of JSON input while parsing near

Full trace:

C:\Models\TravelAgency_videosGX17_FrontEnd\Data084\mobile\Angular\Attractions_CFPanel>npm install
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated joi@9.2.0: This version has been deprecated in accordance with the hapi support policy ([http://hapi.im/support|hapi.im/support]). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions ([http://hapi.im/commercial|hapi.im/commercial]).
npm WARN deprecated request@2.88.2: request has been deprecated, see [https://github.com/request/request/issues/3142]
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy ([http://hapi.im/support|hapi.im/support]). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions ([http://hapi.im/commercial|hapi.im/commercial]).
npm WARN deprecated items@2.1.2: This module has been deprecated in accordance with the hapi support policy ([http://hapi.im/support|hapi.im/support]). Please upgrade to the latest version of hapi to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions ([http://hapi.im/commercial|hapi.im/commercial]).
npm WARN deprecated topo@2.0.2: This version has been deprecated in accordance with the hapi support policy ([http://hapi.im/support|hapi.im/support]). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions ([http://hapi.im/commercial|hapi.im/commercial]).
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see [https://github.com/request/request/issues/3142]
npm WARN deprecated resolve-url@0.2.1: [https://github.com/lydell/resolve-url#deprecated]
npm WARN deprecated urix@0.1.0: Please see [https://github.com/lydell/urix#deprecated]
npm ERR! Unexpected end of JSON input while parsing near '...ies":{"typescript":">'

The json file which fails is random, the important part of the error is the following:

"Unexpected end of JSON input while parsing near... "

Solution 1

1. Open a node js command prompt (as Administrator) and run the following command:

npm cache clean --force

2. Delete node_modules folder and package-lock.json file from the Knowledge Base directory.

3. On the node js command prompt, run this command:

npm install

You should now be able to execute your Angular application.