<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vickucarpenter on Medium]]></title>
        <description><![CDATA[Stories by Vickucarpenter on Medium]]></description>
        <link>https://medium.com/@vickucarpenter4526?source=rss-4dd8470d1d74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fvec5HU2YpIfd_AQ</url>
            <title>Stories by Vickucarpenter on Medium</title>
            <link>https://medium.com/@vickucarpenter4526?source=rss-4dd8470d1d74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:09:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vickucarpenter4526/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AbortController in Production: It Doesn’t Make Your API Faster]]></title>
            <link>https://medium.com/@vickucarpenter4526/abortcontroller-in-production-it-doesnt-make-your-api-faster-1936596f238d?source=rss-4dd8470d1d74------2</link>
            <guid isPermaLink="false">https://medium.com/p/1936596f238d</guid>
            <category><![CDATA[abortcontroller]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vickucarpenter]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 10:17:25 GMT</pubDate>
            <atom:updated>2026-08-04T10:17:25.613Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first learned about <strong>AbortController</strong>, I thought it was a performance optimization tool.</p><p>I assumed that using AbortController would make my APIs respond faster.</p><p>After learning more about production systems, I realized that this is <strong>not true</strong>.</p><h3>What Does AbortController Actually Do?</h3><p>AbortController allows you to <strong>cancel an HTTP request</strong>.</p><p>If an API is taking too long to respond, you can stop waiting and inform the user that the request has timed out.</p><p>This improves the <strong>user experience</strong>, but it does <strong>not</strong> reduce the server’s processing time.</p><p>For example:</p><ul><li>API responds in 1 second → Show the data.</li><li>API responds in 5 seconds → Abort the request after 3 seconds and show a friendly message.</li></ul><p>The user doesn’t have to stare at an endless loading spinner.</p><h3>Why Is This Important in Production?</h3><p>Imagine an e-commerce website.</p><p>A customer clicks <strong>View Products</strong>.</p><p>If the server keeps loading for 20 seconds, the customer may think the website is broken and leave.</p><p>Instead, after a few seconds, you can stop waiting and display:</p><blockquote><em>“The server is taking longer than expected. Please try again.”</em></blockquote><p>This creates a much better experience.</p><h3>Does AbortController Make APIs Faster?</h3><p>No.</p><p>This is one of the biggest misconceptions.</p><p>AbortController only cancels the request on the client side.</p><p>If the backend has already started processing the request, it may continue running unless your backend is designed to handle cancellation.</p><p>So, AbortController is <strong>not</strong> a performance optimization tool.</p><p>It is a <strong>request timeout and user experience tool</strong>.</p><h3>How Do Production Applications Improve API Speed?</h3><p>Fast applications rely on good architecture, not just AbortController.</p><p>Some common production techniques include:</p><h3>1. Database Indexing</h3><p>Indexes allow the database to find records much faster.</p><h3>2. Redis Caching</h3><p>Frequently requested data can be stored in Redis, reducing database load and returning responses in milliseconds.</p><h3>3. Background Jobs</h3><p>Heavy tasks such as:</p><ul><li>Sending emails</li><li>Generating PDFs</li><li>Processing images</li><li>Sending notifications</li></ul><p>should run in the background instead of blocking the API response.</p><h3>4. Pagination</h3><p>Instead of returning 10,000 records, return only the first 20 or 50 records.</p><p>This reduces response time significantly.</p><h3>5. CDN</h3><p>Serve images, CSS, JavaScript, and other static assets through a Content Delivery Network (CDN) for faster delivery.</p><h3>6. Load Balancing</h3><p>Distribute traffic across multiple servers to avoid overloading a single server.</p><h3>7. AbortController</h3><p>Finally, use AbortController to cancel requests that exceed your acceptable response time.</p><p>It should be the <strong>last line of defense</strong>, not the primary performance solution.</p><h3>The Right Mindset</h3><p>Many developers ask:</p><blockquote><em>“How can I make my API return in under 3 seconds?”</em></blockquote><p>The better question is:</p><blockquote><em>“How can I design my system so that users never have a poor experience, even when something is slow?”</em></blockquote><p>That’s where AbortController becomes valuable.</p><h3>Final Thoughts</h3><p>Writing production-ready applications is not only about making APIs work.</p><p>It is about building systems that are:</p><ul><li>Fast</li><li>Reliable</li><li>Scalable</li><li>User-friendly</li></ul><p><strong>AbortController won’t make your API faster.</strong></p><p>But it will make your application feel more responsive by preventing users from waiting forever.</p><p>That’s what production engineering is all about — delivering a great user experience while building a reliable backend.</p><p>Keep learning, keep building, and keep improving. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1936596f238d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shallow Copy]]></title>
            <link>https://medium.com/@vickucarpenter4526/shallow-copy-2a3c012ed410?source=rss-4dd8470d1d74------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a3c012ed410</guid>
            <category><![CDATA[depth]]></category>
            <category><![CDATA[shallow-and-deep-copy-dep]]></category>
            <dc:creator><![CDATA[Vickucarpenter]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 09:55:41 GMT</pubDate>
            <atom:updated>2026-06-26T09:55:41.986Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A shallow copy creates a new object/array but only copies the top-level elements. If the original contains nested objects or arrays, those are still referenced (not copied).</em></p><p>A shallow copy occurs when you copy the reference of an object to a new variable. In this process, only the top-level properties are copied, while nested objects or arrays still reference the original memory location. This means that if you change the nested properties in one object, those changes will reflect in the other because they share the same memory reference.</p><pre>const original = {<br>  name: &quot;Sagar&quot;,<br>  address: { city: &quot;Jaipur&quot; }<br>};</pre><pre>const shallowCopy = { ...original };</pre><pre>console.log(original === shallowCopy); // ❌ false (different objects)<br>console.log(original.address === shallowCopy.address); // ✅ true (same nested reference)</pre><pre>const original = [<br>  { id: 1, name: &quot;Sagar&quot; },<br>  { id: 2, name: &quot;Raj&quot; }<br>];</pre><pre>const shallowCopy = [...original];</pre><pre>// Now change a nested property<br>shallowCopy[0].name = &quot;Aman&quot;;<br>console.log(original[0].name); // ❗ &quot;Aman&quot; → changed in original too</pre><h3>✅ So:</h3><ul><li>shallowCopy !== original (They are <strong>not</strong> the same reference)</li><li>But if original has <strong>nested objects</strong>, their <strong>references are copied</strong></li></ul><h3>Deeep Copy</h3><p><em>A deep copy creates a completely independent copy where all nested objects/arrays are also copied recursively.</em></p><p>A deep copy, on the other hand, creates a completely independent copy of the object, including all nested objects or arrays. This ensures that changes made to one object do not affect the other. Each object is stored in a separate memory location, making them entirely independent.</p><pre>const original = {<br>  name: &quot;Sagar&quot;,<br>  address: { city: &quot;Jaipur&quot; }<br>};</pre><pre>// ✅ Deep copy using JSON methods<br>const deepCopy = JSON.parse(JSON.stringify(original));</pre><pre>console.log(original === deepCopy); // ❌ false (completely new object)<br>console.log(original.address === deepCopy.address); // ❌ false (nested object also copied)</pre><pre>const original = [<br>  { id: 1, name: &quot;Sagar&quot; },<br>  { id: 2, name: &quot;Raj&quot; }<br>];</pre><pre>const deepCopy = original.map(item =&gt; ({ ...item }));</pre><pre>deepCopy[0].name = &quot;Aman&quot;;</pre><pre>console.log(original[0].name); // ✅ &quot;Sagar&quot; → original not affected<br>console.log(deepCopy[0].name); // ✅ &quot;Aman&quot;</pre><h3>⚠️ Limitation of JSON Deep Copy:</h3><ul><li>Cannot copy functions</li><li>Loses undefined, Symbol, Date, Map, Set, circular refs</li></ul><h3>✅ Better (Modern) Way: structuredClone()</h3><p>If you’re in a modern environment (browser or Node.js ≥ v17):</p><pre>const deepCopy = structuredClone(original);</pre><pre>console.log(original === deepCopy); // false<br>console.log(original.address === deepCopy.address); // false</pre><p><a href="https://medium.com/tag/javascript?source=post_page-----e1e200d59178---------------------------------------">JavaScript</a></p><p><a href="https://medium.com/tag/front-end-development?source=post_page-----e1e200d59178---------------------------------------">Front End Development</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a3c012ed410" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[users]]></title>
            <link>https://medium.com/@vickucarpenter4526/users-e8a9c668bad0?source=rss-4dd8470d1d74------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8a9c668bad0</guid>
            <category><![CDATA[mern-stack]]></category>
            <dc:creator><![CDATA[Vickucarpenter]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 06:28:06 GMT</pubDate>
            <atom:updated>2026-05-02T03:38:12.563Z</atom:updated>
            <content:encoded><![CDATA[<pre>import React, { useEffect, useState } from &quot;react&quot;;<br>import axios from &quot;../api/axios.js&quot;;<br><br>const Users = () =&gt; {<br>  const [users, setUsers] = useState([]);<br>  const [formData, setFormData] = useState({<br>    username: &quot;&quot;,<br>    email: &quot;&quot;,<br>    password: &quot;&quot;,<br>  });<br>  const [editId, setEditId] = useState(null);<br>  const [showModal, setShowModal] = useState(false);<br>  const [selectedIds, setSelectedIds] = useState([]);<br><br>  useEffect(() =&gt; {<br>    const getUsers = async () =&gt; {<br>      try {<br>        const res = await axios.get(&quot;/users&quot;);<br>        const data = res.data?.data || res.data || [];<br>        setUsers(Array.isArray(data) ? data : []);<br>      } catch (error) {<br>        console.log(error);<br>      }<br>    };<br><br>    getUsers();<br>  }, []);<br><br>  const handleAdd = () =&gt; {<br>    setFormData({ username: &quot;&quot;, email: &quot;&quot;, password: &quot;&quot; });<br>    setEditId(null);<br>    setShowModal(true);<br>  };<br><br>  const handleEdit = (user) =&gt; {<br>    if (!user) return;<br>    setFormData({<br>      username: user.username,<br>      email: user.email,<br>      password: user.password,<br>    });<br>    setEditId(user._id);<br>    setShowModal(true);<br>  };<br><br>  const handleChange = (e) =&gt; {<br>    setFormData({ ...formData, [e.target.name]: e.target.value });<br>  };<br><br>  const handleCheckboxChange = (id) =&gt; {<br>    if (!id) return;<br>    if (selectedIds.includes(id)) {<br>      setSelectedIds(selectedIds.filter((item) =&gt; item !== id));<br>    } else {<br>      setSelectedIds([...selectedIds, id]);<br>    }<br>  };<br><br>  const handleSelectAll = (e) =&gt; {<br>    if (e.target.checked) {<br>      <br>const allIds = users.map((user) =&gt; user._id);<br>      setSelectedIds(allIds);<br><br>    } else {<br>      setSelectedIds([]);<br>    }<br>  };<br><br>  const handleDeleteMultiple = async () =&gt; {<br>    try {<br>      await axios.delete(&quot;/users/delete-multiple&quot;, { data: { ids: selectedIds } });<br>      setUsers(users.filter((user) =&gt; !selectedIds.includes(user._id)));<br>      setSelectedIds([]);<br>    } catch (error) {<br>      console.error(error);<br>    }<br>  };<br><br>  const handleDelete = async (id) =&gt; {<br>    if (!id) return;<br>    try {<br>      await axios.delete(`/users/${id}`);<br>      setUsers(users.filter((user) =&gt; user &amp;&amp; user._id !== id));<br>    } catch (error) {<br>      console.error(error);<br>    }<br>  };<br><br>  const handleSubmit = async (e) =&gt; {<br>    e.preventDefault();<br><br>    try {<br>      if (editId) {<br>        const res = await axios.put(`/users/${editId}`, formData);<br>        const updatedUser = res.data?.data || res.data;<br><br>        setUsers(<br>          users.map((user) =&gt;<br>            user &amp;&amp; user._id === editId ? updatedUser : user<br>          )<br>        );<br>      } else {<br>        const res = await axios.post(&quot;/users&quot;, formData);<br>        const newUser = res.data?.data || res.data;<br><br>        if (newUser) {<br>          setUsers([...users, newUser]);<br>        }<br>        <br>      }<br><br>      setFormData({ username: &quot;&quot;, email: &quot;&quot;, password: &quot;&quot; });<br>      setEditId(null);<br>      setShowModal(false);<br>    } catch (error) {<br>      console.log(error);<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;p-6&quot;&gt;<br>      &lt;h2 className=&quot;text-2xl font-bold mb-4&quot;&gt;User List&lt;/h2&gt;<br><br>      &lt;button<br>        onClick={handleAdd}<br>        className=&quot;bg-blue-500 text-white px-4 py-2 rounded mb-2&quot;<br>      &gt;<br>        Add User<br>      &lt;/button&gt;<br><br>      &lt;button<br>        onClick={handleDeleteMultiple}<br>        className=&quot;bg-red-500 text-white px-4 py-2 rounded mb-4 ml-2&quot;<br>        disabled={selectedIds.length === 0}<br>        style={{ opacity: selectedIds.length === 0 ? 0.5 : 1 }}<br>      &gt;<br>        Delete Selected<br>      &lt;/button&gt;<br><br>      &lt;table className=&quot;w-full border&quot;&gt;<br>        &lt;thead className=&quot;bg-gray-200&quot;&gt;<br>          &lt;tr&gt;<br>            &lt;th className=&quot;p-2 border&quot;&gt;<br>              &lt;input<br>                type=&quot;checkbox&quot;<br>                onChange={handleSelectAll}<br>                checked={<br>                  users.length &gt; 0 &amp;&amp;<br>                  selectedIds.length === users.length<br>                }<br>              /&gt;<br>            &lt;/th&gt;<br>            &lt;th className=&quot;p-2 border&quot;&gt;Username&lt;/th&gt;<br>            &lt;th className=&quot;p-2 border&quot;&gt;Email&lt;/th&gt;<br>            &lt;th className=&quot;p-2 border&quot;&gt;Password&lt;/th&gt;<br>            &lt;th className=&quot;p-2 border&quot;&gt;Action&lt;/th&gt;<br>          &lt;/tr&gt;<br>        &lt;/thead&gt;<br><br>        &lt;tbody&gt;<br>          {users.map((user) =&gt;<br>            user ? (<br>              &lt;tr key={user._id}&gt;<br>                &lt;td className=&quot;p-2 border&quot;&gt;<br>                  &lt;input<br>                    type=&quot;checkbox&quot;<br>                    checked={selectedIds.includes(user._id)}<br>                    onChange={() =&gt; handleCheckboxChange(user._id)}<br>                  /&gt;<br>                &lt;/td&gt;<br>                &lt;td className=&quot;p-2 border&quot;&gt;{user.username}&lt;/td&gt;<br>                &lt;td className=&quot;p-2 border&quot;&gt;{user.email}&lt;/td&gt;<br>                &lt;td className=&quot;p-2 border&quot;&gt;{user.password}&lt;/td&gt;<br>                &lt;td className=&quot;p-2 border flex gap-2&quot;&gt;<br>                  &lt;button<br>                    onClick={() =&gt; handleEdit(user)}<br>                    className=&quot;bg-yellow-400 px-2 py-1 rounded&quot;<br>                  &gt;<br>                    Edit<br>                  &lt;/button&gt;<br>                  &lt;button<br>                    onClick={() =&gt; handleDelete(user._id)}<br>                    className=&quot;bg-red-400 px-2 py-1 rounded text-white&quot;<br>                  &gt;<br>                    Delete<br>                  &lt;/button&gt;<br>                &lt;/td&gt;<br>              &lt;/tr&gt;<br>            ) : null<br>          )}<br>        &lt;/tbody&gt;<br>      &lt;/table&gt;<br><br>      {showModal &amp;&amp; (<br>        &lt;div className=&quot;fixed inset-0 flex items-center justify-center bg-black/40&quot;&gt;<br>          &lt;div className=&quot;bg-white rounded-lg shadow-lg w-96 p-6&quot;&gt;<br>            &lt;div className=&quot;flex justify-between mb-4&quot;&gt;<br>              &lt;h3 className=&quot;text-lg font-semibold&quot;&gt;<br>                {editId ? &quot;Edit User&quot; : &quot;Add User&quot;}<br>              &lt;/h3&gt;<br>              &lt;button onClick={() =&gt; setShowModal(false)}&gt;✖&lt;/button&gt;<br>            &lt;/div&gt;<br><br>            &lt;form onSubmit={handleSubmit}&gt;<br>              &lt;input<br>                type=&quot;text&quot;<br>                name=&quot;username&quot;<br>                value={formData.username}<br>                onChange={handleChange}<br>                className=&quot;w-full border p-2 mb-3 rounded&quot;<br>                placeholder=&quot;Enter Username&quot;<br>              /&gt;<br>              &lt;input<br>                type=&quot;email&quot;<br>                name=&quot;email&quot;<br>                value={formData.email}<br>                onChange={handleChange}<br>                className=&quot;w-full border p-2 mb-3 rounded&quot;<br>                placeholder=&quot;Enter Email&quot;<br>              /&gt;<br>              &lt;input<br>                type=&quot;password&quot;<br>                name=&quot;password&quot;<br>                value={formData.password}<br>                onChange={handleChange}<br>                className=&quot;w-full border p-2 mb-3 rounded&quot;<br>                placeholder=&quot;Enter Password&quot;<br>              /&gt;<br>              &lt;button className=&quot;w-full bg-blue-500 text-white py-2 rounded&quot;&gt;<br>                {editId ? &quot;Update&quot; : &quot;Create&quot;}<br>              &lt;/button&gt;<br>            &lt;/form&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default Users<br>const User = require(&quot;../models/UserSchema.js&quot;);<br>const createUser = async (req, res) =&gt; {<br>  try {<br>    const { username, email, password } = req.body;<br>    if (!username || !email || !password) {<br>      return res.status(400).json({<br>        message: &quot;All fields are required.&quot;,<br>      });<br>    }<br><br>    const user = await User.create({ username, email, password });<br><br>    res.status(201).json({<br>      message: &quot;User created successfully&quot;,<br>      data: user,<br>    });<br>  } catch (error) {<br>    console.log(&quot;Error creating user:&quot;, error);<br>    res.status(500).json({ message: &quot;Internal server error&quot; });<br>  }<br>};<br><br>const getAllUsers = async (req, res) =&gt; {<br>  try {<br>    const allUsers = await User.find().sort({ createdAt: -1 });<br>    if (allUsers.length === 0) {<br>      return res.status(404).json({<br>        message: &quot;No users found.&quot;,<br>        data: [],<br>      });<br>    }<br><br>    res.status(200).json({<br>      message: &quot;Users fetched successfully&quot;,<br>      data: allUsers,<br>    });<br>  } catch (error) {<br>    console.log(&quot;Error fetching users:&quot;, error);<br>    res.status(500).json({<br>      message: error.message,<br>    });<br>  }<br>};<br><br>const updateUser = async (req, res) =&gt; {<br>  try {<br>    const { id } = req.params;<br><br>    const updatedUser = await User.findByIdAndUpdate(id, req.body, {<br>      new: true,<br>    });<br>    if (!updatedUser) {<br>      return res.status(404).json({<br>        message: &quot;User not found.&quot;,<br>      });<br>    }<br><br>    res.status(200).json({<br>      message: &quot;User updated successfully&quot;,<br>      data: updatedUser,<br>    });<br>  } catch (error) {<br>    console.log(&quot;Error updating user:&quot;, error);<br>    res.status(500).json({<br>      message: error.message,<br>    });<br>  }<br>};<br><br>const deleteUser = async (req, res) =&gt; {<br>  try {<br>    const { id } = req.params;<br>    const deletedUser = await User.findByIdAndDelete(id);<br>    if (!deletedUser) {<br>      return res.status(404).json({<br>        message: &quot;User not found.&quot;,<br>      });<br>    }<br>    res.status(200).json({<br>      message: &quot;User Deleted Successfully&quot;,<br>    });<br>  } catch (error) {<br>    console.log(&quot;Error deleting user:&quot;, error);<br>    res.status(500).json({<br>      message: error.message,<br>    });<br>  }<br>};<br><br>const multipleDeleteUsers = async (req , res) =&gt; {<br>    try {<br>        const { ids } = req.body;   <br>        if (!ids || !Array.isArray(ids) || ids.length === 0) {<br>            return res.status(400).json({<br>                message: &quot;IDs array is required.&quot;,<br>            });<br>        }<br>        await User.deleteMany({ _id: { $in: ids } });<br>        res.status(200).json({<br>            message: &quot;Users deleted successfully&quot;,<br>        });<br><br>    } catch (error) {<br>        console.log(&quot;Error deleting users:&quot;, error);<br>        res.status(500).json({<br>            message: error.message,<br>        });<br>    }<br>}<br><br><br>module.exports = {<br>  createUser,<br>  getAllUsers,<br>  updateUser,<br>  deleteUser,<br>  multipleDeleteUsers,<br>};</pre><p>users</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8a9c668bad0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a React App Using NVM (Node Version Manager)]]></title>
            <link>https://medium.com/@vickucarpenter4526/how-to-create-a-react-app-using-nvm-node-version-manager-e02349b27820?source=rss-4dd8470d1d74------2</link>
            <guid isPermaLink="false">https://medium.com/p/e02349b27820</guid>
            <category><![CDATA[nvm]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[read]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Vickucarpenter]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 07:39:40 GMT</pubDate>
            <atom:updated>2025-02-21T07:45:01.571Z</atom:updated>
            <content:encoded><![CDATA[<p>NVM (Node Version Manager) helps you install and manage multiple Node.js versions on your system. Here’s how you can use it to create a React app:</p><h3>Step 1: Install NVM (if not installed)</h3><h3>For Windows:</h3><ol><li>Download and install <a href="https://github.com/coreybutler/nvm-windows/releases">NVM for Windows</a>.</li><li>After installation, restart your terminal and verify the installation:</li></ol><pre>nvm -v</pre><h3>For macOS/Linux:</h3><ol><li>Run the following command in the terminal:</li></ol><pre>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash</pre><p>Restart your terminal or run:</p><pre>source ~/.bashrc   # or ~/.zshrc for macOS</pre><p>Verify installation:</p><pre>nvm -v</pre><p>Step 2: Install Node.js Using NVM</p><h3>Check available Node.js versions:</h3><pre>nvm ls-remote</pre><ol><li>Install the latest <strong>LTS (Long-Term Support) version</strong>:</li></ol><pre>nvm install --lts</pre><ol><li>Or install a specific version (e.g., Node 18):</li></ol><pre>nvm install 18</pre><p>Set the default Node.js version:</p><pre>nvm use 18</pre><p>Verify Node.js and npm versions:</p><pre>node -v npm -v</pre><h3>Step 3: Create a New React App</h3><p>Install create-react-app:</p><pre>npm install -g create-react-app</pre><p>Create a new React project:</p><pre>npx create-react-app my-app</pre><p>npx ensures you use the latest version of create-react-app without globally installing it.</p><p>Navigate to the project folder:</p><ol><li>Start the development server:</li></ol><pre>npm start</pre><h3>Step 4: Switch Node Versions (if needed)</h3><ul><li>To check installed Node.js versions:</li></ul><pre>nvm ls</pre><pre>nvm use 16</pre><pre>nvm alias default 18</pre><h3>Step 5: Running Your React App</h3><p>If everything is set up correctly, you will see:</p><pre>Compiled successfully!<br>You can now view my-app in the browser.</pre><p>Open your browser and go to: <a href="http://localhost:3000/"><strong>http://localhost:3000/</strong></a> 🎉</p><h3>🚀 Quick Summary</h3><p>1️⃣ Install <strong>NVM</strong><br>2️⃣ Install <strong>Node.js</strong> using nvm install --lts<br>3️⃣ Create a <strong>React app</strong> using npx create-react-app my-app<br>4️⃣ Navigate to the project and run npm start</p><p>And Exuction policy error so can try change exuction policy</p><h3><strong>How to Fix Execution Policy Error in Windows (NVM, npm, PowerShell Issues)</strong></h3><p>If you see an <strong>Execution Policy error</strong> while using NVM, npm, or PowerShell, it usually looks something like this:</p><pre>nvm : File C:\Users\yourname\AppData\Roaming\nvm\nvm.ps1 cannot be loaded because running scripts is disabled on this system.</pre><p>This happens because PowerShell <strong>restricts script execution</strong> for security reasons. You need to change the <strong>execution policy</strong> to allow running scripts.</p><h3>🛠 Fix: Change Execution Policy</h3><h3>Step 1: Open PowerShell as Administrator</h3><ol><li>Press Win + S and type <strong>PowerShell</strong></li><li>Right-click on <strong>Windows PowerShell</strong> and select <strong>Run as administrator</strong></li></ol><h3>Step 2: Check the Current Execution Policy</h3><p>Run this command in PowerShell:</p><pre>Get-ExecutionPolicy</pre><p>If it returns <strong>Restricted</strong>, then PowerShell is blocking script execution.</p><h3>Step 3: Change Execution Policy</h3><p>Run this command to allow scripts to run:</p><pre>Set-ExecutionPolicy RemoteSigned -Scope CurrentUser</pre><ul><li><strong>RemoteSigned</strong> → Allows local scripts to run but blocks unsigned remote scripts.</li><li><strong>CurrentUser</strong> → Changes policy only for your user account (safe).</li></ul><p>If prompted, type <strong>Y</strong> and press <strong>Enter</strong>.</p><h3>Step 4: Verify the Change</h3><p>Run this command again:</p><pre>Get-ExecutionPolicy</pre><p>If it now shows <strong>RemoteSigned</strong>, the issue is fixed.</p><h3>Step 5: Restart PowerShell and Try Again</h3><ul><li>Close PowerShell</li><li>Reopen it</li><li>Try running nvm, npm, or any other command that gave an error.</li></ul><h3>❗ Alternative (If Error Persists)</h3><p>If you still face issues, try this command:</p><pre>Set-ExecutionPolicy Unrestricted -Scope CurrentUser</pre><p>This removes all script restrictions but is <strong>less secure</strong>. Use it only if necessary.</p><h3>🔄 Reverting Back (For Security)</h3><p>If you want to reset the execution policy later, run:</p><pre>Set-ExecutionPolicy Restricted -Scope CurrentUser</pre><p>This will <strong>block all scripts again</strong>.</p><h3>🚀 Summary</h3><p>1️⃣ <strong>Check policy</strong> → Get-ExecutionPolicy<br>2️⃣ <strong>Change policy</strong> → Set-ExecutionPolicy RemoteSigned -Scope CurrentUser<br>3️⃣ <strong>Verify</strong> → Get-ExecutionPolicy<br>4️⃣ <strong>Restart PowerShell and try again</strong></p><p>Now your scripts (NVM, npm, etc.) should work! 🚀 Let me know if you face any issues. 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e02349b27820" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>