NPM is short for "Node Package Manager". It is a platform that holds countless amounts of stuff people have built, similiarly to GitHub. NPM is different in the way that it allows you to easily manage your Node Packages.
You don't have to learn about Node to use NPM. You will have to install both though.
Let's dig in.
To get started, you need to install Node.js and npm. Here is the official guide.
One thing that I noticed is that for Windows users, you have to use the nvm-windows version. Follow the "Download Now" link to get to the latest version and then just find the "nvm-setup.zip" file, download and run it.
Now if you open the Command Prompt and type:
You should see the currently installed version get listed aswell as commands you can execute.
And you should get your Node.js version.
Then lastly execute:
And you should see the version of npm.
I actually encountered an error message:
npm : File C:\Users\artur\AppData\Roaming\npm\npm.ps1 cannot be loaded. The file C:\Users\artur\AppData\Roaming\npm\npm .ps1 is not digitally signed. You cannot run this script on the current system. ...
This means your security is working well and doesn't allow executing just any sorta script that you want.
Automating stuff is fun. Getting automatically hacked for sensitive data is not so fun. If you think that hackers manually go through your PC to find stuff, that's very naive. They execute pre-written code to do their work as quickly as possible for maximum effect.
That's why script execution on your PC could be disabled.
Actually after digging around for a moment, I found out that this is happening relatively recently with npm. There are workarounds, starting with the safest:
As far as I understand, npm had a command prompt version and then they updated to use PowerShell instead. The previous version still works, so all you have to do is delete (or rename) the .ps1 file that is described in the error message. Then it will fall back onto the .cmd version.
To view your current security settings for executing scripts, open PowerShell and execute:
You can read more on what each tier of security means in the official docs.
Disabling or lowering your security levels is risky. Don't tinker with it if you don't wan't to endanger your data.
To enable running npm on the local machine you'd do it like this:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
More info on
As stated in the official docs you can unblock a single file from the RemoteSigned policy if even just enabling the RemoteSigned policy doesn't help right away.
So just copy the path stated in your error all the way with the ".ps1" extension included:
Unblock-File -Path <path to npm>
If that doesn't work for you, you can also run PowerShell as admin, by right clicking it and selecting "Run as Administrator".
So once you can view the versions for Node and NPM, you're good.
You can also avoid nvm altogether and install them using the usual installer. Although it's not recommended by npm developers, but it should work.
To get further with the posts, you have to be able to see the versions of npm and Node.js.