Blog

PCF Components -  What to do when strange errors occur when calling NPM commands

If you receive strange errors when attempting to call NPM, here's what you can do to try to fix the error.

If you haven't developed PCF components for a while but have been keeping the CLI (command line interface) up-to-date regularly by calling "pac install latest", it's possible to encounter strange errors when you attempt to call the npm commands, such as "npm install" or "npm run build".


The most likely cause of this problem is that the version of Node and NPM on your machine is out of date. You can check the version of Node and NPM on your machine by running the following commands respectively.
 
node -v
npm -v

To update Node, the easiest way is to download and reinstall the latest version from the official Node.js website.


Installing the latest version of Node will also update NPM. However, it's possible to update NPM independently by calling the following command.
 
npm install -g npm

Once you do this, the errors should no longer occur and you should be able to continue developing the components as normal.
  •   Categories: 
  • pcf