<?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: Ziyi Chu</title>
    <description>The latest articles on DEV Community by Ziyi Chu (@ziyi_chu).</description>
    <link>https://dev.to/ziyi_chu</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%2F2087128%2Ff132980a-7374-4e27-bc09-217669231416.png</url>
      <title>DEV Community: Ziyi Chu</title>
      <link>https://dev.to/ziyi_chu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ziyi_chu"/>
    <language>en</language>
    <item>
      <title>Command nvm not found and Command node not found after already installed nvm on MacOS?</title>
      <dc:creator>Ziyi Chu</dc:creator>
      <pubDate>Tue, 17 Sep 2024 14:33:52 +0000</pubDate>
      <link>https://dev.to/ziyi_chu/command-nvm-not-found-and-command-node-not-found-after-already-installed-nvm-on-macos-4m6o</link>
      <guid>https://dev.to/ziyi_chu/command-nvm-not-found-and-command-node-not-found-after-already-installed-nvm-on-macos-4m6o</guid>
      <description>&lt;p&gt;Why do we see these types of errors?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Command nvm not found
Command node not found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we didn't add the source lines to the correct shell startup script, that is, ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc, depending on the shell program you are using.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you find these startup scripts?
&lt;/h2&gt;

&lt;p&gt;These files that begin with a "." are usually hidden, so you can't find them in the Finder, or by "ls" command.&lt;/p&gt;

&lt;p&gt;Find hidden files in the Finder Window: Press Command-Shift-period&lt;/p&gt;

&lt;p&gt;To find hidden files in terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~
ls -a ~
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Source lines to add
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//source line added
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] &amp;amp;&amp;amp; \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] &amp;amp;&amp;amp; \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reference:&lt;br&gt;
1.&lt;a href="https://blog.logrocket.com/how-switch-node-js-versions-nvm/" rel="noopener noreferrer"&gt;https://blog.logrocket.com/how-switch-node-js-versions-nvm/&lt;/a&gt;&lt;br&gt;
2.&lt;a href="https://discussions.apple.com/thread/254493189?sortBy=rank" rel="noopener noreferrer"&gt;https://discussions.apple.com/thread/254493189?sortBy=rank&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to fix the: "EMFILE: too many open files, watch" error in macOS</title>
      <dc:creator>Ziyi Chu</dc:creator>
      <pubDate>Tue, 17 Sep 2024 14:23:07 +0000</pubDate>
      <link>https://dev.to/ziyi_chu/how-to-fix-the-emfile-too-many-open-files-watch-error-in-macos-gl2</link>
      <guid>https://dev.to/ziyi_chu/how-to-fix-the-emfile-too-many-open-files-watch-error-in-macos-gl2</guid>
      <description>&lt;p&gt;I've tried to build a react-native project on my MacBook Pro, but when running the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I get the error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: EMFILE: too many open files, watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are several solutions online, but they are scattered, so I am here to summarize.&lt;/p&gt;

&lt;p&gt;Solution1: watchman&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install watchman
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The watchman utility enables React-Native to watch file changes.&lt;/p&gt;

&lt;p&gt;Solution 2: change Node.js version with nvm&lt;/p&gt;

&lt;p&gt;Run the command below to check the Node version:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Switch Node version by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install --&amp;lt;the node version&amp;gt;
nvm use &amp;lt;version_number&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install 12.18.3
nvm use 12.18.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see all Node versions you've installed, use:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To see all published Node versions, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm ls-remote
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usually, we should try several versions. Newest(v22.8.0), new(v20.0), and old (v17.3). This should solve the problem.&lt;/p&gt;

&lt;p&gt;Reference:&lt;br&gt;
1.&lt;a href="https://flaviocopes.com/react-native-emfile-too-many-open-files/" rel="noopener noreferrer"&gt;https://flaviocopes.com/react-native-emfile-too-many-open-files/&lt;/a&gt;&lt;br&gt;
2.&lt;a href="https://flatirons.com/blog/how-to-set-a-default-node-version-with-nvm/" rel="noopener noreferrer"&gt;https://flatirons.com/blog/how-to-set-a-default-node-version-with-nvm/&lt;/a&gt;&lt;br&gt;
3.&lt;a href="https://blog.logrocket.com/how-switch-node-js-versions-nvm/" rel="noopener noreferrer"&gt;https://blog.logrocket.com/how-switch-node-js-versions-nvm/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
