After copying to another computer, Node is unable to locate previously installed modules or add new ones

After transferring my project to a new computer using a synchronization service, I checked the folder permissions with ls -l and everything seemed correct.

The project is a strapi app, and when I run npm run develop, I encounter the following error:


>  [email protected] develop
> strapi develop

sh: 1: strapi: not found

I initially created the app with

npx create-strapi-app@latest strapi-hugo-blog
, which installed strapi as a dependency. Later, I updated it with npm install on the original computer.

Performing a new npm install results in the following error:

npm ERR! code 1
npm ERR! path /home/me/my-app/node_modules/esbuild
npm ERR! command failed
.. (error details)

Attempting to reinstall strapi generates additional errors and warnings related to deprecated Strapi version 3, despite having version 4 in the package-lock file.

Running npm with sudo does not resolve the issue, as all dependencies are locally installed.

When reverting to the original computer with the synchronization service, everything functions correctly. Node versions on both systems are similar (v18.17.1 / v18.13.0).

Answer №1

To address challenges like this, consider removing your node_modules folder and package-lock.json files, then perform a fresh installation using npm install.


Migrating the node_modules folder may not resolve the issue due to potential differences in operating systems, OS versions, architecture, node/npm versions, and more between the two computers.

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

Error: The function semrush.backlinks_refdomains does not exist as a valid function

Hey there! So I've been working with the SEMRUSH API and encountered an issue when trying to retrieve data using backlinks_refdomains and backlinks_refips. However, when I called the domain_rank function, it responded in JSON format without any proble ...

Why is there a delay in processing queries and requests in the MEAN Stack?

Recently, I've been diving into Node.js and experimenting with building a web app using the MEAN stack. One particular issue I encountered involved sending an array of strings (e.g., ["one", "two", "three"]) to the server side. In response, I attempt ...

Node Module log statements not showing up in console

I am just starting out with Node JS. I recently installed a module using npm install '<module_name>. The installation process went smoothly without any errors. Now, I wanted to debug the module so I added some console.log('some text') ...

Leveraging environment variables within package.json

Working on an older application, I've encountered a challenge where the API endpoint URL varies depending on the system. Currently, my package.json file looks like this: "start": "cross-env API_ENDPOINT=http://localhost:5000/api/v1 react-scripts sta ...

Searching Within Array Elements in MongoDB: A Comprehensive Guide

While this question may be simple for experienced Mongo users, I have been struggling to find the answer. Here is an example of the type of documents in my collection: { _id:"2a1fd96c-73c5-49e1-a8ca-bd03a20c0197", timestamp:1519725979178, storeID:"x ...

Encountering an issue in my Node terminal program with the message "Error: Cannot find module."

Encountered an error: Last login: Thu Dec 23 12:32:55 on ttys000 juliedecraene@Julies-MBP ~ % node -- version node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module '/Users/juliedecraene/version' at Function.Module._ ...

What steps should I take to fix the issue of "[ERR_REQUIRE_ESM]: Must use import to load ES Module" while working with D3.js version 7.0.0 and Next.js version 11.0.1?

Encountered a roadblock while integrating D3 with Next.js - facing an error when using D3.js v7.0.0 with Next.js v11.0.1: [ERR_REQUIRE_ESM]: Must use import to load ES Module Tried utilizing next-transpile-modules without success Managed to make D3.js ...

Tips for receiving string body parameters from Express routes in TypeScript instead of using the 'any' type?

I have a situation where I am passing a unique identifier called productId as a hidden input within a form: <form action="/cart" method="POST"> <button class="btn" type="submit">Add to Cart</button ...

Obtaining the TCP Socket ID Upon Establishing Connection with the Server

One question I have is, How can I retrieve the TCP Socket Id when it's connected to the server? Here's the code snippet I am working with: const net = require('net'); const server = net.createServer(); server.listen(port, host, async( ...

Guide on adding logout feature with jsonwebtoken in node.js

One common approach is to delete the browser's cookie first. However, I am interested in learning how to destroy tokens from the server side or how to verify logout functionality from the server side. ...

Installing npm results in an excessive number of dependencies being added to the node_modules folder

Lately, I've been encountering an issue where running npm install results in numerous extra node modules being added beyond what is specified in package.json. One explanation suggests that this behavior is a new feature of npm 3, known as dependency ...

What alternatives are available to eliminate the need for body-parser?

After successfully installing the express module and body-parser, I realized that I can now utilize express to gather all necessary information from the user without the need for body-parser. How can I safely remove body-parser from my configuration? cli ...

Angular Universal is experiencing difficulties resolving dependencies

After finally migrating my existing Angular project from v8 to v13.0.0, I decided to incorporate SSR into it. The process of updating the project itself was time-consuming and challenging. Once the app successfully ran on v13.0.0, I attempted to add SSR b ...

Express/React: Using Relative Paths for Static Files

Currently, my react client is running on localhost:3000 while my express server is running on localhost:4000. In the server, there is a static folder containing images. I am facing an issue where I need to store the image path in a MySQL database and use ...

What sets apart lib and lib-cov in the realm of Express?

Just diving into the world of Node.js. Let me wrap my head around this line: module.exports = process.env.EXPRESS_COV ? require("./lib-cov/express") : require("./lib/express"); I understand that EXPRESS_COV is a Boolean, but can someone explain to me the ...

Generating various API calls and delivering them to a template (Express + Node.js + Facebook open graph)

I am currently developing a unique Express Node.js application that utilizes the extraordinary capabilities of this remarkable Facebook SDK. Allow me to present my existing route for the root: app.get('/', Facebook.loginRequired(), function (req ...

What is the best approach for implementing an Express Form that allows for image uploads to S3, with the subsequent saving of the S3 URL to a MongoDB field?

I am facing a roadblock at the moment. I have a form that is used for writing blog posts and I was previously using multer to upload images to mongodb as a datastream. However, due to scalability issues, I decided to switch to uploading images to S3 but I& ...

What is the procedure for accessing a namespace when declaring it globally?

Website Project Background Currently, I am working on a simple website where users can update their pictures. To achieve this functionality, I am utilizing the Multer library along with Express in Typescript. Encountered Issue I am facing a challenge re ...

I received a "quota exceeded" message from Mongolab, even though I had only used up half of my allotted storage space

I have set up a Sandbox database for an amateur project that I am working on for a competition. This is my first time doing something like this, and unfortunately, I made the mistake of waiting until the very end to upload all the records I need for analys ...

Restoring a mongo database in chai mocha: step-by-step guide

Before starting the tests, I need to restore the mongo database. Here's how I do it: const app = require("../app"); const chai = require("chai"); const mongoose = require("mongoose"); const User = require('../models/users'); const Region = ...