When I run pnpm install
I get this error message:
pnpm : File C:UsersUserAppDataRoamingnpmpnpm.ps1 cannot be loaded. The file
C:UsersUserAppDataRoamingnpmpnpm.ps1 is not digitally signed. You cannot run this script on the current system.
For more information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ pnpm install
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I’m trying to open my website that run in node JavaScript environment
2
Answers
It seems like you are encountering an issue related to PowerShell script execution policies. The error is indicating that the script "C:UsersUserAppDataRoamingnpmpnpm.ps1" is not digitally signed, and the execution policy on your system is preventing the execution of unsigned scripts.
You can resolve this issue by adjusting the PowerShell execution policy to allow the execution of unsigned scripts. Here are the steps to change the execution policy:
Open PowerShell as an administrator:
Check the current execution policy:
If the current policy is set to "Restricted" or "AllSigned," you may need to change it to "RemoteSigned" or "Unrestricted" to allow the execution of unsigned scripts. To change the execution policy, run:
If prompted, confirm the change.
After making the change, try running your script again.
Keep in mind that changing the execution policy may pose security risks, so it’s recommended to set it back to a more restrictive policy after completing your task. You can set it back to the original policy by running:
Replace
<OriginalPolicy>
with the value obtained in step 2.Remember to only change the execution policy if you trust the scripts you are running. If possible, sign scripts with a digital signature for increased security.
The error you’re encountering is related to PowerShell’s script execution policy. PowerShell has a security feature that restricts the execution of scripts for security reasons.
To resolve this issue, you can try the following steps:
1. Change Execution Policy:
Open PowerShell as an administrator and run the following command to set the execution policy to allow script execution:
After running this command, try running your
pnpm install
command again.2. Run PowerShell as Administrator:
Sometimes, the script execution policy change might not take effect if PowerShell is not run as an administrator. Ensure that you open PowerShell as an administrator by right-clicking on the PowerShell icon and selecting "Run as Administrator."
3. Signed Scripts:
If you are concerned about security, you can sign the script. However, keep in mind that this requires a valid code signing certificate.
Replace
cert:CurrentUserMy
with the location of your code signing certificate.4. Use Bypass Option (Not Recommended for Security Reasons):
As a temporary solution, you can use the
-ExecutionPolicy Bypass
option with your command:Keep in mind that bypassing the execution policy poses security risks, so it’s not recommended for long-term use.
After successfully running your command, you might want to revert the execution policy to a more restrictive setting for security reasons:
Choose the method that best fits your security requirements.