Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Cerlancism opened this issue Nov 11, 2019 · 10 comments
Closed

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

Cerlancism opened this issue Nov 11, 2019 · 10 comments
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@Cerlancism
Copy link

Cerlancism commented Nov 11, 2019

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

@Cerlancism Cerlancism changed the title tsc.ps1 present %appdata%\npm tsc.ps1 presence %appdata%\npm Nov 11, 2019
@Cerlancism
Copy link
Author

Cerlancism commented Nov 11, 2019

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.

@AviVahl
Copy link

AviVahl commented Nov 11, 2019

npm fixed it in 6.13.0 npm/cli#281

@Cerlancism
Copy link
Author

Cerlancism commented Nov 11, 2019

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.

@AviVahl
Copy link

AviVahl commented Nov 11, 2019

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

@Cerlancism Cerlancism changed the title tsc.ps1 presence %appdata%\npm tsc.ps1 presence in %appdata%\npm Nov 11, 2019
@fatcerberus
Copy link

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.

@RyanCavanaugh RyanCavanaugh added the External Relates to another program, environment, or user action which we cannot control. label Nov 11, 2019
@typescript-bot
Copy link
Collaborator

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

@v-katmas
Copy link

v-katmas commented Dec 3, 2019

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.

@haiderlasne
Copy link

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

@MikeInSwitzerland
Copy link

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

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

@Skumbl
Copy link

Skumbl commented Aug 19, 2022

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
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

9 participants