Skip to content

tsc.ps1 presence in %appdata%\npm #35031

Description

@Cerlancism

I am not sure why there are ps1 files for tsc and tsserver and now I longer able to use tsc on PowerShell as I got the error

tsc.ps1 cannot be loaded because running scripts is disabled on this system

I tried to install tsc on my other Windows 10 machine, it does not come with ps1 files.

TypeScript Version: Version 3.7.2

Search Terms:
tsc.ps1
tsc.ps1 cannot be loaded because running scripts is disabled on this system

Activity

  1. changed the title [-]tsc.ps1 present %appdata%\npm[/-] [+]tsc.ps1 presence %appdata%\npm[/+] on Nov 11, 2019
  2. Cerlancism commented on Nov 11, 2019

    @Cerlancism
    Author

    Looks like the current npm version will include ps1 scripts after installing global packages. I am not sure where to report this to npm. Seems like my other machine also faced this issue after updating npm, which implies all npm global packages will not work by default on Powershell from now without mingling it's security settings.

  3. AviVahl commented on Nov 11, 2019

    @AviVahl

    npm fixed it in 6.13.0 npm/cli#281

  4. Cerlancism commented on Nov 11, 2019

    @Cerlancism
    Author

    npm fixed it in 6.13.0 npm/cli#281

    It is not about uninstalling though.

    It looks like everyone who is using Powershell(basically all Windows VSC terminal users)from now on needs to set the flag (RemoteSigned?) to use global npm packages.

  5. AviVahl commented on Nov 11, 2019

    @AviVahl

    Ouch. Might want to report this behavior change in the npm/cli repository: https://github.com/npm/cli/issues

  6. changed the title [-]tsc.ps1 presence %appdata%\npm[/-] [+]tsc.ps1 presence in %appdata%\npm[/+] on Nov 11, 2019
  7. fatcerberus commented on Nov 11, 2019

    @fatcerberus

    Indeed - just for the heck of it I opened PowerShell just now:

    PS C:\Users\fatce> tsc
    tsc : File C:\Users\fatce\AppData\Roaming\npm\tsc.ps1 cannot be loaded because running scripts is disabled on this
    system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
    At line:1 char:1
    + tsc
    + ~~~
        + CategoryInfo          : SecurityError: (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess

    Not very nice, and I use cmd so I never noticed! This isn't a TypeScript issue, though.

  8. typescript-bot commented on Nov 14, 2019

    @typescript-bot
    Contributor

    This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  9. v-katmas commented on Dec 3, 2019

    @v-katmas

    I had the same issue. Need to run PowerShell as Admin and set the execution policies. In Win10 updates PowerShell has some restrictions for outer scripts. I've set the rights to the policies, but it didn't worked.
    I decided to use Git Bash because it's easier for me and there is no issues.

  10. haiderlasne commented on Sep 19, 2021

    @haiderlasne

    To fix it you have to run the command below to run Set-ExecutionPolicy and change the Execution Policy setting.
    open PowerShell
    cd C:\Windows\System32>
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypassts

  11. MikeInSwitzerland commented on Aug 6, 2022

    @MikeInSwitzerland

    Haiderlasne had the correct solution (but there was a subtle error)

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
    
    
  12. Skumbl commented on Aug 19, 2022

    @Skumbl

    The works for the current session, I just set mine for my local machine

    Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Bypass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions