If you have problems running create-react-app in text editors but the package is installed globally. So here is the SOLUTION-------------
Open PowerShell as an administrator. You can do this by right-clicking on the Windows Start button and selecting "Windows PowerShell (Admin)".
In the PowerShell window, run the following command to check the current execution policy:
powershellGet-ExecutionPolicy
The output will be one of the following:
- Restricted: This means that script execution is disabled. You need to change it to a more permissive policy.
- AllSigned or RemoteSigned: These policies allow script execution but require digitally signed scripts. If you encounter this, you can skip changing the execution policy and try using the
npx create-react-app
command instead ofcreate-react-app
.
To change the execution policy to allow script execution, run the following command:
powershellSet-ExecutionPolicy Unrestricted
You will be prompted to confirm the change. Type
Y
and press Enter.After changing the execution policy, you should be able to use the
create-react-app
command without encountering the "running scripts is disabled" error.Once you've finished using
create-react-app
, it's recommended to set the execution policy back to a more secure value. Run the following command:powershellSet-ExecutionPolicy Restricted
By following these steps, you should be able to resolve the script execution error and use create-react-app globally in any text editor.