7

I am getting the error "'npm' is not recognised as an internal or external command" while creating project in VS code using Salesforce CLI. Don't know what I am missing out. Can anyone guide me.

enter image description here

  • 1
    NPM is part of Node.Js, you have to install Node.js for it. Node is not installed along with Salesforce CLI installation. – Raul May 1 at 9:42
  • Than you Raul. But could you please let me know why the need to install Node.js as I need to work with Salesforce Apex – Shravan Kumar R. May 1 at 9:57
  • You just mentioned the npm problem, but maybe you should edit your question and add proper details on what is the exact issue. – Raul May 1 at 10:00
  • I have just added the error message that I am getting when I try to create a new project in VS – Shravan Kumar R. May 1 at 10:05
  • 2
    I see you are trying to create a project, sfdx uses node.js under the hood for its tooling and it is a prerequisite. Please try installing nde and try again. – Raul May 1 at 10:08
5

I started facing the same issue, the very moment I updated Salesforce CLI to the latest version "sfdx-cli/7.56.1-2773b53bf5".

Everything was fine before this version of CLI, however, seems that this version requires NPM package manager as well for CLI to run but it's not auto-installed or prompted by any means during CLI update that it's required.

The only solution I found to make it work as of now on my Windows machine, is by installing the NPM package manager and it started to work like it was.

| improve this answer | |
  • 2
    Alternatively, installing nodejs would suffice. – sfdcfox May 1 at 12:25
  • Installing NodeJs did the trick. Thank you all for the guidance. – Shravan Kumar R. May 1 at 13:13
  • Thanks! it worked – malu May 15 at 15:42
3

I was also facing this error..... is because of the Node.js not installed or it has older version. I have installed latest node.js with npm from https://www.npmjs.com/get-npm

this solved the issue!

| improve this answer | |
  • Thanks for adding the link to install. Google failed me when I searched for it – Salesforce Wizard May 20 at 16:49
1

The error is because of the Node.js not installed or it has older version install latest node.js with npm from https://www.npmjs.com/get-npm

Setup user variable for the installed Node.js --> "C:\Program Files\nodejs

Which will solve the issue!

| improve this answer | |
0

Installing node.js fixed the "npm not recognized as...." error, which I started getting abruptly today (was working fine till yesterday). Also, I only saw this error while creating components. Other commands (e.g. sfdx deploy ) worked fine even before the node.js install.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.