Reputation: 620
I try to install a nodemon for the auto-restart nodejs server when my file has been changed. But I got two warnings so, I try to install other npm packages like forever or pm2, but I still get the same warning. Here is my warning capture:
Upvotes: 0
Views: 3531
Reputation: 388
Well it is an old question but since this is the first result on google and the above solutions did not work for me, I will share my solution.
In my case it was a version issue with npm: I try to install pm2 with node version 17.8.0 and npm version 8.3.1 but I can not made it.
Based on that issue on github: https://github.com/npm/cli/issues/4234, downgrade node version to 16.13.2 and npm version 8.1.2 fix the problem.
using nvm:
nvm install 16.13.2
nvm use 16.13.2
npm install -g pm2
Upvotes: 0
Reputation: 31
Windows 10 has execution policy built in that restrict any script execution by default. So, you have to set the policy first.
In Powershell (Admin rights), first look at the ExecutionPolicy with command
Get-ExecutionPolicy -List
'Undefined' policy means scripts like pm2 will be restricted. To enable it, run command
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
Then, try run pm2.
Upvotes: 3
Reputation: 3266
Try,
npm cache clear -f
and,
npm install pm2 -g --unsafe-perm
Upvotes: 2