NPM is giving me a headache as it throws an error whenever I attempt to install a new package

Hey there, I'm having an issue with installing node packages in my react app. Every time I try to install one, I keep getting this error message:

npm ERR! path C:\Users\earth\Desktop\Project\DAPP\client\node_modules\websocket
npm ERR! code EISGIT
npm ERR! git C:\Users\earth\Desktop\Project\DAPP\client\node_modules\websocket: Appears to be a git repo or submodule.
npm ERR! git     C:\Users\earth\Desktop\Project\DAPP\client\node_modules\websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\earth\AppData\Roaming\npm-cache\_logs\2019-04-01T19_35_16_846Z-debug.log

I'm stuck and unable to install any new packages. Any advice on how to resolve this problem?

Answer №1

After hours of searching, I finally cracked it. It's funny how things work out sometimes: no luck finding a solution on my own, but as soon as I reach out for help on StackOverflow, the answer becomes clear.

Turns out, the issue was due to a .git folder lingering in

C:\Users\earth\Desktop\Project\DAPP\client\node_modules\websocket
. Once I removed it manually, the package installation went smoothly.

Answer №2

After struggling to delete node_modules and package-lock.json three times without success, I tried both using command line and manually but it didn't work out.

Eventually, I discovered that the only effective solution was to use yarn install instead of npm install after getting rid of node_modules and package-lock.json. If you are unfamiliar with yarn, you can learn more by visiting Yarn Package Website

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

Troubleshooting npm authorization problems

I've been experiencing permission challenges while attempting to install certain packages. For instance, I tried installing now-serve using the command npm install -g now-serve and encountered an EACCESS error as follows: npm WARN deprecated <a hr ...

Containerize your Laravel/VueJS application using Docker

My goal is to dockerize my Laravel application, and I have come across various tutorials that seem helpful: Tutorial 1 Tutorial 2 Tutorial 3 Tutorial 4 In my development Dockerfile, I have defined the necessary steps for setting up the environment. Ho ...

The npm encountered an error with code ENOENT and an error number of 34

Here is my initial script setup for a React project. "scripts": { "prestart": "babel-node tools/startMessage.js", "start": "npm-run-all --parallel test:watch open:src lint:watch", "open:src": "babel-node tools/srcServer.js", "lint": "node_ ...

Issue encountered while trying to run `npm install` on an angular-cli

I recently moved my angular-cli project with node modules to a new directory. Upon running npm install, I encountered the following warnings: npm WARN deprecated <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e2838c85978e8 ...

Jest encountered an error while attempting to parse the TypeScript configuration file

I've been working on setting up Jest with Babel and Typescript, following the guidelines provided here. However, when I run npm run test, I encounter the error message: Error: Jest: Failed to parse the TypeScript config file C:...jest.config.js` Th ...

When attempting to run the Hugo command with the production environment, an error occurred stating "Unknown: command not found" on line 136 in the

My development setup includes hugo, doks, and GitLab. In my repository, I have the following configuration in the .gitlab-ci.yml file: --- image: node:latest variables: HUGO_ENV: production GIT_SUBMODULE_STRATEGY: recursive before_script: - npm ins ...

Ensuring the existence of a MySQL database prior to executing a Node.js application

I am currently working on a Node.js/Express application that communicates with a MySQL server using Sequelize. I want to make sure that a particular database is created before the app starts running when using npm start. I think I need to create a one-ti ...

Is it acceptable to use "*" for the dependency version in NPM Workspaces / monorepo?

It appears to be functioning properly, { "dependencies": { "my-local-dep": "*" } } Instead of having fake 0.0.1 version numbers stamped in. Is this considered suitable or troublesome? When I execute >npm update, it does at ...

PhoneGap has been encountering issues during installation and is malfunctioning

Upon the completion of NodeJs installation and running npm install -g phonegap, I encountered an output that deviated significantly from the expected format: C:\Program Files\nodejs>npm install -g phonegap | > <a href="/cdn-cgi/l/emai ...

caret (^) indicates dependencies for NPM

Imagine you released two packages on NPM: x (1.0.0) y (1.0.0) `-- x (^1.0.0) If you have this package.json in your project: { "dependencies": { "x": "^1.0.0", "y": "^1.0.0" } } After running npm install, the folders are found in node_mod ...

Adding ngx-bootstrap with the ng add command

Currently working with angular 8 and attempting to add ngx bootstrap using the command ng add ngx-bootstrap. However, upon running the command, the following error message appears in the console output: Added "bootstrap Added "ngx-bootstrap ...

"Error message pops up indicating the dispatcher is missing while using npm link with a local project

Currently, I am working on a React component library that I want to integrate into a local project for testing purposes. My initial approach was to use npm link to connect the component library with my local project. However, during this process, I encount ...

Learn how to selectively update a single file within the node_modules directory rather than upgrading the entire package

Seeking to enhance the yarn.lock file in the node_modules directory to resolve vulnerabilities linked to Raven. The specific path of the file is located below: src/node_modules/form-data/yarn.lock Aware that utilizing npm install can add a new package, ...

The Next.js development was hindered by a webpack issue causing the build to

Whenever I try to build my next.js app using npm run build, npm fails and crashes while trying to access the logo.png file from the public directory. This directory is where all static assets like images and icons are stored, so I'm unsure why this er ...

"Enhance your command line experience by utilizing CLI tools while running bash on Windows with the

After setting up NPM and Git for Windows, along with several global NPM packages accessible from the command line, I wonder: if I use the bash shell in the Windows Subsystem for Linux, will I need to reinstall all these tools within the Linux subsystem a ...

Apologies, but the development JavaScript bundle could not be generated due to an unexpected token error with code #981

After cloning my repository and installing all packages via npm, I encountered an error when trying to start my program with gatsby develop. The error appears in all files within the templates directory. https://i.stack.imgur.com/MsAUm.png I've atte ...

Identifying edited files within the node_modules directory: A comprehensive guide

While working with the serverless framework, I installed it using npm. During my debugging process, I made some modifications by adding console.log statements to different files within the node_modules folder. Unfortunately, I can't recall which speci ...

When attempting to build in sync-cloud-server, the command "npm install" may lead to encountering errors

Currently, I am in the process of setting up this cloud-sync-server: https://github.com/2-IMMERSE/cloud-sync Upon running npm install, a series of errors pop up: npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a ...

The internal cjs loader in node threw an error at line 1078

I'm encountering an error on Windows 10 when running the npm command: node:internal/modules/cjs/loader:1063 throw err; ^ Error: Cannot find module 'D:\mobile-version portfolio\ at Module._resolveFilename (node:internal/modules/cjs/load ...

Use gulp to quickly install google-webfonts with npm

Can anyone advise on whether gulp google-webfonts should be installed with --save-dev for devDependencies or --save for bower.json dependencies? I am currently working on a project using Yeoman scaffolding with gulp and I am unfamiliar with this process. ...