Encountering the "node:internal/modules/cjs/loader:1050" error while attempting to execute a folder using the "npm run dev" command

I am encountering an issue while attempting to execute a folder using npm run dev, consistently resulting in the same error message.

PS C:\Users\My Name\Desktop\My Folder> npm run dev
Debugger attached.

> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c49404d4b4d42580141595f454f014d5c5c6c1c021c021c">[email protected]</a> dev
> vite

'Folder\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
Debugger attached.
Waiting for the debugger to disconnect...
node:internal/modules/cjs/loader:1050
  throw err;
  ^

Error: Cannot find module 'C:\Users\My Name\Desktop\vite\bin\vite.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.14.0
Waiting for the debugger to disconnect...

The directory I am running from is referenced in this YouTube video: https://www.youtube.com/watch?v=I1cpb0tYV74 https://drive.google.com/file/d/1iTlXIZ4T3BBKjgLMsDpQn-Eux1B3ZyXO/view

My objective is to obtain a localhost link for initiating coding tasks.

How can I resolve this issue?

Multiple attempts have been made, including restarting VS Code and re-running npm run dev, without success.

Answer №1

To troubleshoot, consider removing the node_modules and package-lock.json files from your project directory while keeping the package.json file intact. Then, execute 'npm install' in the terminal to re-install dependencies. Wait for the installation to complete before restarting your code editor. Hopefully, this solution resolves your issue.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to generate a box when a button is pushed?

How can I make a button create a box with text inside it when clicked? <div class="trades"> </div> <button onclick="create()">add</button> Here is the JavaScript function to create the box: function create() { var box = docu ...

Sending an array from the front-end to the back-end in Laravel with JavaScript

I am experiencing difficulty passing a objs array to a function in a Laravel controller using ajax. Unfortunately, I am not receiving any data after the post request. <script> var itemCount = 0; var objs=[]; $(document).read ...

Issues with jQuery code functionality within web forms

After creating a jQuery script to alter the CSS of a table row, I tested it on JSFiddle and it worked perfectly. However, when implemented into my web project, it doesn't seem to be functioning as intended. See the code below: HTML: <script src ...

Retrieve data from a JSON file using Ajax and jQuery

I have a JSon file that contains information about some matches: [{ "id": "2719986", "orario": "00:30", "casa": "Bahia", "trasferta": "Internacional" } , { "id": "2719991", "orario": "02:00", "casa": "Palmeiras", "trasferta": "Botafogo RJ" }] I'v ...

Executing the Javascript function after the dynamic loading of the table through an ajax request

After the table finishes loading, I would like to trigger a JavaScript function. Originally, I considered using the onload() function on the table, but I discovered that it does not actually work for tables. ...

Begin the API server along with the React server for your React application

I'm currently working on my first React app, and I'm facing a challenge in getting both the API and the React server to start simultaneously. For client routes, I am using react-router. In a previous project, I utilized Express for setting up th ...

Tips on emphasizing all div elements and incorporating navigation to each of them

I am seeking a method to enhance a div with highlighting when there is a click or mouseover event. For instance, changing or adding a border color using JavaScript on click or mouseover is straightforward. Recently, I have been contemplating the idea of a ...

SwiperJS continuously applies additional right margin to every slide

My Swiper carousel seems to be adding an unnecessary 5px margin-right to each slide, resulting in the cards not fitting into one frame. https://i.sstatic.net/fwn5G.png I attempted to fix this by setting the margin-right to 0px for the .swiper-slide class ...

Issue with React occurring when attempting to delete an input component

I seem to be facing a challenge that I can't quite figure out whether it's related to React or not. To help illustrate the issue, I've created a simple example outside of my project: https://codepen.io/as3script/pen/VMbNdz?editors=1111 Wit ...

Problem with jQuery: Modifications to CSS made before an each loop are only applied afterwards

Below is some code I am working with: LoadingImage.show("#contentpage", urlStk.LoadImg); var errors = 0; var ComponentToUpdate = new Array(); var storedItems = JSON.parse(localStorage.getItem("Components")); $(".myDataGridRow").each(function () { er ...

Guide to implementing the Office 365 Javascript API in your application

Looking to integrate an Office 365 Excel sheet with the necessary toolbars into my web-based application, similar to this setup (including the Excel Online toolbar above). Link Here Unsure of the process - is there a way to implement tables and toolbars ...

Adding React annotations to components to trigger a function before they are rendered

In my RBAC use case, each component will have annotations that trigger a pre-render function called "check access." This function determines whether the component should be rendered or not. Is this scenario feasible without using switch or if-else state ...

Obtaining the scene's coordinates in Three.js

Struggling with a coding issue, I've scanned various discussions that don't quite address my specific problem. Any assistance would be greatly appreciated. In my HTML document, I am using the three.js library to create a scene titled scaledScene ...

Do not allow negative values to be displayed in the text box

Plunker I need to restrict negative values from being entered into a text field. If the user tries to input a negative value, I want the text box to remain unchanged. Although I have a directive that prevents negative values from being entered, it seems ...

What is the specific type of event for a change handler in TypeScript?

As a newcomer to TypeScript, I recently crafted a change handling function that accepts the event as a parameter to assign the value, like event.target.value. Currently, I have designated this as any, but I suspect there is a more appropriate type for this ...

Modifying the structure of serialized data

After serializing a JS form, the data looks like this: .....&xx=xxx&otherError=&input=SMS&message=sdfgs&...... Can anyone provide guidance on how to replace the value of message with the content of a textarea before making an ajax cal ...

Spacious width that doesn't require a horizontal scrollbar for navigation

My dilemma is with the width of my body and background image. I set the body width to 1920px to match the background-image for the header. However, since I have a narrower wrapper inside the body, the header background's width gets cut off by the wrap ...

Personalized JQuery popup before leaving the page

Looking to display a unique jQuery dialog box with options for Yes, No, and Cancel when a user attempts to navigate away from the current page or close the window. The default browser dialog confirmation is displayed on the beforeload event, but we are tr ...

Using JavaScript, retrieve the ID of a child element by utilizing details about the parent element

I have implemented a JavaScript function that creates a div element. Within this div, there are multiple checkboxes as child elements. My goal is to use a loop to extract the ids of all these checkboxes. The div has been assigned to a variable named: o ...

Elements generated from bootstrap's divs are not produced in a single line

I'm attempting to have a div append multiple other divs with the class "card" from Bootstrap, but instead of being created in a horizontal line, they are stacked on top of each other. I have tried to modify the "card" class by adding display: inline- ...