<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Osama Shaikh</title>
    <description>The latest articles on DEV Community by Osama Shaikh (@osamashaikh90).</description>
    <link>https://dev.to/osamashaikh90</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1002209%2F6a3c2333-2c3b-4a5d-a2e7-9f273c5c2376.jpeg</url>
      <title>DEV Community: Osama Shaikh</title>
      <link>https://dev.to/osamashaikh90</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/osamashaikh90"/>
    <language>en</language>
    <item>
      <title>Best ways to fix Nodemon error- nodemon.ps1 cannot be loaded because running scripts is disabled on this system.</title>
      <dc:creator>Osama Shaikh</dc:creator>
      <pubDate>Wed, 31 May 2023 05:30:01 +0000</pubDate>
      <link>https://dev.to/osamashaikh90/best-ways-to-fix-nodemon-error-nodemonps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-1kia</link>
      <guid>https://dev.to/osamashaikh90/best-ways-to-fix-nodemon-error-nodemonps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-1kia</guid>
      <description>&lt;p&gt;Welcome to my blog, where we dive into the intriguing world of &lt;a href="https://www.w3schools.com/nodejs/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; development and tackle one of the common stumbling blocks many developers encounter: the "&lt;strong&gt;Nodemon Error - nodemon.ps1 cannot be loaded because running scripts is disabled on this system.&lt;/strong&gt;" If you've ever come across this error while working with &lt;a href="https://nodemon.io/" rel="noopener noreferrer"&gt;Nodemon&lt;/a&gt;, fear not! In this article, we will explore the causes behind this issue, understand why scripts are disabled on certain systems and most importantly, provide you with practical solutions to overcome this obstacle and keep your development workflow seamless. So, let's embark on this troubleshooting journey together and empower ourselves to conquer the Nodemon Error!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx66hivwv8we53nwri2qa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx66hivwv8we53nwri2qa.png" alt="Error Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Causes behind the Error⚠️
&lt;/h3&gt;

&lt;p&gt;Before we dive into the solutions, let's first understand why the "&lt;strong&gt;nodemon.ps1 cannot be loaded&lt;/strong&gt;" error occurs in the first place. &lt;em&gt;By default, Windows PowerShell has a restricted execution policy, which means that it will only run scripts that are signed by a trusted publisher.&lt;/em&gt; This helps to prevent malicious scripts from being executed on your system.&lt;/p&gt;

&lt;h3&gt;
  
  
  2 ways to fix the error are🛠️:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Unrestricting the &lt;u&gt;Execution-Policy&lt;/u&gt;.&lt;/li&gt;
&lt;li&gt;Deleting the &lt;u&gt;nodemon.ps1&lt;/u&gt; from local device.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. Unrestricting the Execution-Policy.
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 1:
&lt;/h4&gt;

&lt;p&gt;open Windows PowerShell as an administrator.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2:
&lt;/h4&gt;

&lt;p&gt;Run the following command in the PowerShell.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Get-ExecutionPolicy


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It will give you "&lt;strong&gt;Restricted&lt;/strong&gt;" or "&lt;strong&gt;AllSigned&lt;/strong&gt;" or "&lt;strong&gt;RemoteSigned&lt;/strong&gt;". So, this is the main reason behind the error as running scripts on the system is '&lt;strong&gt;Restricted&lt;/strong&gt;'.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3:
&lt;/h4&gt;

&lt;p&gt;Use this command to make it Unrestricted -&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Set-ExecutionPolicy Unrestricted


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After executing the command, you will get to see a prompt asking for allowance to change the execution policy.&lt;br&gt;
&lt;strong&gt;Press Y&lt;/strong&gt; to change the execution policy.&lt;br&gt;
The &lt;strong&gt;problem&lt;/strong&gt; is &lt;strong&gt;solved&lt;/strong&gt;. Now you can use &lt;strong&gt;nodemon&lt;/strong&gt; on your machine.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; Note that running scripts with an unrestricted execution policy can be a security risk. If you are not sure whether or not a script is safe to run, you should not run it.&lt;br&gt;
&lt;strong&gt;This way is not much advisable as  Changing the execution policy might expose you to the security risks described in the&lt;/strong&gt; &lt;br&gt;
 &lt;a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2" rel="noopener noreferrer"&gt;about_Execution_Policies&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  2. Deleting the nodemon.ps1 from local device.
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;So we have another solution which is very easy and safe😍&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1:
&lt;/h4&gt;

&lt;p&gt;Open your File Explorer and enter the path in the File path section &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

C:\Users\(Your username)\AppData\Roaming\npm


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0h86pmxwqudzgdes6oje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0h86pmxwqudzgdes6oje.png" alt="File Location Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2:
&lt;/h4&gt;

&lt;p&gt;Delete the file with name--&amp;gt;nodemon and type--&amp;gt;windows PowerShell script(.ps1) in properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnks45fo6w0gekt5lgbci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnks45fo6w0gekt5lgbci.png" alt="File"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iyflufrp4uz6tkvsgeo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iyflufrp4uz6tkvsgeo.png" alt="File properties"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hooray! The &lt;strong&gt;error&lt;/strong&gt; is &lt;strong&gt;fixed&lt;/strong&gt;. Now you can use &lt;strong&gt;nodemon&lt;/strong&gt; on your machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2q53daj7owjzha3th1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2q53daj7owjzha3th1k.png" alt="perfect output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the easiest and safest way as compared to the first way, Hence it is much advisable to use.&lt;br&gt;
Now its upto you .... which one you choose.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;In conclusion, the "&lt;strong&gt;Nodemon Error - nodemon.ps1 cannot be loaded because running scripts is disabled on this system&lt;/strong&gt;" can be a frustrating obstacle for Node.js developers. However, armed with the knowledge and solutions provided in this blog post, you are now prepared to overcome this issue and recover control of your Nodemon-powered development workflow.&lt;br&gt;
In this article we have discussed 2 ways to fixed this error and both the ways are explained properly with pros and cons.&lt;br&gt;
I hope this article has been helpful in &lt;strong&gt;troubleshooting&lt;/strong&gt; and &lt;strong&gt;resolving&lt;/strong&gt; this common issue.&lt;br&gt;
&lt;strong&gt;Stay tuned🤗 for more insightful content, practical tips, and solutions to keep your development journey smooth and error-free. Happy coding😉!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>node</category>
      <category>nodemon</category>
      <category>security</category>
    </item>
  </channel>
</rss>
