skip to Main Content

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


  1. 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:

    1. Open PowerShell as an administrator:

      • Right-click on the PowerShell icon or the Start button and choose "Run as administrator."
    2. Check the current execution policy:

      Get-ExecutionPolicy
      
    3. 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:

      Set-ExecutionPolicy RemoteSigned
      

      If prompted, confirm the change.

    4. 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:

    Set-ExecutionPolicy <OriginalPolicy>
    

    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.

    Login or Signup to reply.
  2. 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:

    Set-ExecutionPolicy Unrestricted
    

    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.

    Set-AuthenticodeSignature -FilePath "C:UsersUserAppDataRoamingnpmpnpm.ps1" -Certificate (Get-ChildItem cert:CurrentUserMy -CodeSigningCert)
    

    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:

    pnpm install -ExecutionPolicy Bypass
    

    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:

    Set-ExecutionPolicy Restricted
    

    Choose the method that best fits your security requirements.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search