Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR - node:internal/modules/cjs/loader:936 throw err; #3709

Closed
GabrielCHP opened this issue Jan 27, 2022 · 131 comments
Closed

ERROR - node:internal/modules/cjs/loader:936 throw err; #3709

GabrielCHP opened this issue Jan 27, 2022 · 131 comments

Comments

@GabrielCHP
Copy link

Version

No response

Platform

Windows Powershell

Subsystem

Powershell

What steps will reproduce the bug?

Downloading node.js > Opening the Windows Powershell > Selecting the Folder > node install. # Not working!

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'C:__MACOSX\hashlips\install'
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}

Additional information

BUG

@mscdex mscdex transferred this issue from nodejs/node Jan 27, 2022
@Goldzik2
Copy link

Goldzik2 commented Feb 6, 2022

I have the same problem

@shabbir23ah
Copy link

Same problem, any solution??

@Glitchbes
Copy link

Glitchbes commented Feb 13, 2022

same shit!

PS C:\hashlips_art_engine-1.1.1_update> node utils/nftport/uploadFiles.js
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'C:\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js'
?[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)?[39m
?[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)?[39m
?[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)?[39m
?[90m at node:internal/main/run_main_module:17:47?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: []
}

@Soroushj1
Copy link

same problem

@Glitchbes
Copy link

Glitchbes commented Feb 14, 2022 via email

@abvillarreal
Copy link

Hello, the same issue
i even tried reinstalling everything, and nothing good happened.
I thought the problem was the version because i installed v17.5.0, so i uninstalled and installed v16.14.0
but same thing.
I manually tried to install the package with the command npm i npm-cli or command npm install npm-cli
The first time before downgrading node version, it was working fine the installation but errors were still there. after the downgrade, doesn't even try to install because immediately after shows the error.
Is there anybody who passed through this and is now happily ever after creating new projects..

BR everyone

@nkilm
Copy link

nkilm commented Feb 18, 2022

Yeah I'm facing similar problem.
image

Any solution(s) for this?

@AdamSioud
Copy link

I also need help here! much needed, thanks:)

@paulius-bulotas
Copy link

Same i need help, thanks for any information 👍

@nkilm
Copy link

nkilm commented Feb 20, 2022

Recently I was doing one simple project which would show Riddles in Command Line. I published it as npm package, but when I execute it (npx riddles-cli) I get the above mentioned error.

Repository link:
https://github.com/nkilm/riddles-in-CLI-a-npm-package

npm package
https://www.npmjs.com/package/riddles-cli

@marsonya
Copy link
Member

marsonya commented Feb 21, 2022

Can someone post a code snippet that can be used to reproduce or an example?
Kindly share details of the steps followed and commands. It will help in understanding and resolving the issue.

@ralfs66
Copy link

ralfs66 commented Feb 22, 2022

Following this tutorial results in specified error
https://www.youtube.com/watch?v=KkZ6iYnSDRw

@nkilm
Copy link

nkilm commented Mar 2, 2022

any updates?

@dookpook
Copy link

dookpook commented Mar 9, 2022

anyone know how to fix already?? its f ing up my discord bot learning process (:

@nkilm
Copy link

nkilm commented Mar 9, 2022

One thing I observed is that this error occurs when we don't install the required dependencies correctly. But this works only for some cases, but it didn't work for me.

So for now try this,

  • Delete the node_modules folder
  • Re-Install the necessary modules

Hope this helps😅

@dookpook
Copy link

dookpook commented Mar 9, 2022

yooo thanks man, im gonna try that rn. but how do i re-install the necessary modules?

@nkilm
Copy link

nkilm commented Mar 9, 2022

Welcome:)

All the type of dependencies are present in package.json file,

So all you have to do is,
open your terminal in project folder and execute the below command.

npm i

or

npm install 

Both should work fine😅

@dookpook
Copy link

dookpook commented Mar 9, 2022

its still giving this error
2022-03-09 17_57_11-Desktop
could it maybe be the code?

@nkilm
Copy link

nkilm commented Mar 9, 2022

Well it seems this method is not working even for you(Even I'm getting the same error).

We'll figure out something.

@dookpook
Copy link

dookpook commented Mar 9, 2022

could you add me on discord so we could think of a solution or so you could let me now if theres a solutions found?
its dookpook#0001

@taleleni
Copy link

taleleni commented Mar 9, 2022

Hello All,
I installed the very latest version 17.7.0 on windows but got the same error :(
I even tried restalling and uninstalling too. but the same error coms with version 16 too.

Is there anybody who passed through this
. Kindly let me know.

@taleleni
Copy link

taleleni commented Mar 9, 2022

Welcome:)

All the type of dependencies are present in package.json file,

So all you have to do is, open your terminal in project folder and execute the below command.

npm i

or

npm install 

Both should work fine😅

not working. getting same error

@dookpook
Copy link

dookpook commented Mar 9, 2022

Welcome:)
All the type of dependencies are present in package.json file,
So all you have to do is, open your terminal in project folder and execute the below command.

npm i

or

npm install 

Both should work fine😅

not working. getting same error

i know man had the same thing );

@Soroushj1
Copy link

Soroushj1 commented Mar 9, 2022 via email

@dookpook
Copy link

dookpook commented Mar 9, 2022

i was thinking of resetting my pc and starting over my project, is this gonna fix the issue?

@nkilm
Copy link

nkilm commented Mar 9, 2022

could you add me on discord so we could think of a solution or so you could let me now if theres a solutions found? its dookpook#0001

Yeah sure I'll add you!

My discord username: nkilm#7651

@nkilm
Copy link

nkilm commented Mar 9, 2022

Hello All, I installed the very latest version 17.7.0 on windows but got the same error :( I even tried restalling and uninstalling too. but the same error coms with version 16 too.

Is there anybody who passed through this . Kindly let me know.

Already tried that one, but no luck.

@nkilm
Copy link

nkilm commented Mar 9, 2022

i was thinking of resetting my pc and starting over my project, is this gonna fix the issue?

I don't think it is related to PC, something with nodejs itself.

@dookpook
Copy link

dookpook commented Mar 9, 2022

i was thinking of resetting my pc and starting over my project, is this gonna fix the issue?

I don't think it is related to PC, something with nodejs itself.

alr accepted the fr

@Momosa123
Copy link

Hey everyone,
for me the problem was the name of my folder which had an &.
After deleting this character it worked fine

@ihsan16110
Copy link

Hello everyone,
In my case, there was a problem with my folder naming which had an & . After removing the character, it worked well for me.

@Pamelamorim1
Copy link

Pamelamorim1 commented Sep 24, 2022

No meu caso consegui resolver o mesmo problema, indo em cima do documento js e com o lado direito do mouse cliquei em Abrir no terminal integrado. E voltou a funcionar no meu. Espero ter ajudado.
Essa resolução é com base no VsCode.

@devvsakib
Copy link

No meu caso consegui resolver o mesmo problema, indo em cima do documento js e com o lado direito do mouse cliquei em Abrir no terminal integrado. E voltou a funcionar no meu. Espero ter ajudado. Essa resolução é com base no VsCode.

can you write in english please?

@Pamelamorim1
Copy link

No meu caso consegui resolver o mesmo problema, indo em cima do documento js e com o lado direito do mouse cliquei em Abrir no terminal integrado. E voltou a funcionar no meu. Espero ter ajudado. Essa resolução é com base no VsCode.

can you write in english please?
Yes.
Regarding my case, I managed to solve the same problem, going on top of the js document and with the right side of the mouse, I clicked "Open in the integrated terminal". And it worked on mine again. Hope this helps.
This resolution is based on VsCode.

@vonshirco
Copy link

npm run dev

This Worked for me, thanks

@Benja1512
Copy link

Benja1512 commented Nov 4, 2022

I also have the same problem

image
but i just found that my index.js wasnt not in general directory, it should be on there. so the index.js cannot be in another file. directory that shouldnt the general directory where node_module should it be. The Index.js mustnt be on view file or public file or routes files, because when u will run ur npm run dev, it will appear this common error,

look.

I hope that it solved out your problems colleagues. if so, just comment me.

image

so for me it worked
image

@VadymVashchuk
Copy link

Guys I had exactly the same problem and I managed to solve it in my case. When I wrote in VS Code terminal "node script.js" - I had this error. BUT! When I just wrote there "node ./script.js" it perfectly worked.
In other case I had to wrote full path from main folder like this: "node ./parentfolder/script.js" - and it also worked.
Maybe I didn't understand your problem guys, but I fixed my similar case with this simple code change.

@123je
Copy link

123je commented Nov 11, 2022

También tengo el mismo problema

imagen pero acabo de descubrir que mi index.js no estaba en el directorio general, debería estar allí. por lo que index.js no puede estar en otro archivo. directorio que no debería ser el directorio general donde debería estar node_module. El Index.js no debe estar en el archivo de vista o en el archivo público o en los archivos de rutas, porque cuando ejecute su npm run dev, aparecerá este error común,

Mira.

Espero haber solucionado sus problemas colegas. si es así solo comentame.

imagen

así que para mí funcionó imagen

hola bro creo que estamos en el mismo proyecto mas o menos pero no te entiendo bien como lo solucionastes mira!, pues yo lo que hize fue sacar el archivo index.js y el app pero nada el mismo error

image

@devvsakib
Copy link

@123je that's not the accurate solution i guess, cz mine didn't worked

@SaadRupai
Copy link

Ran into a similar issue with nodemon running through docker,

it'd be worth checking that your "main" file in your package.json is configured to point at the correct entry point

in package.json

"main": "server.js",
"scripts": {
"start":"nodemon src/server.js",
"docker:build": "docker build -f ./docker/Dockerfile . "
},

@torquan
Copy link

torquan commented Nov 30, 2022

Another possible reason:

I had a file called .yarnrc.yml in my project, fixing the required version:

yarnPath: .yarn/releases/yarn-3.2.4.cjs

On my server, this version was not installed, resulting in a similar error.

@Prajwal100
Copy link

Try with a different node version. i tried with node 14.10.0 it's working.

@leandroArraes
Copy link

No terminal chamar o arquivo --> node arquivo.js
eu estou reinstalndo a versão LTS do node para testar

@MohsenCreative
Copy link

the solution is pretty easy. in windows go to the C:\Users\yourusername\AppData\Roaming find the npm folder and delete it. then open PowerShell in your project folder and type npm install ......

@clemir-legon
Copy link

I recommend deleting the folder: node_modules and then running the command: npm install, that works.

@Alina-github
Copy link

Reinstalling node modules right in the directory specified in the Error message helped in my case!
--Works now--

@Nermeen-M
Copy link

I faced the same problem, the reason was that project path contains the letter "&"
Ex: D:\Projects & Assignments\project-1
The solution is to remove or replace this special character, and it works fine with me now.

@JuliaThTranNguyen
Copy link

JuliaThTranNguyen commented Mar 5, 2023

Version

No response

Platform

Windows Powershell

Subsystem

Powershell

What steps will reproduce the bug?

Downloading node.js > Opening the Windows Powershell > Selecting the Folder > node install. # Not working!

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'C:__MACOSX\hashlips\install' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }

Additional information

BUG

Problem solved with :
Step 1 : rm package-lock.json
Step 2: rm -rf node_module
Step 3: npm install
--- Wait until the installation has fully completed---

Then try to run:
npm start

----------It should work by now-------------

@fadsel
Copy link

fadsel commented Apr 10, 2023

Remove your corrupted local copy

yum remove nodejs npm
yum clean all

Install a fresh one

yum install -y nodejs npm

image

You are now good to go 👍

@mihailshikov
Copy link

Hello everyone, In my case, there was a problem with my folder naming which had an & . After removing the character, it worked well for me.

this helps for me

@Astitva877
Copy link

Version

No response

Platform

Windows Powershell

Subsystem

Powershell

What steps will reproduce the bug?

Downloading node.js > Opening the Windows Powershell > Selecting the Folder > node install. # Not working!

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'C:__MACOSX\hashlips\install' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }

Additional information

BUG

To solve this issue.

  • First delete node_modules
  • Then delete the package-lock.json file
  • Then run npm install
  • Then run npx react-native start

@pterpstra
Copy link

In Kali i had to run 'npm i'.
After that 'npm audit fix' twice.

@KryptonBD
Copy link

Anyone who's still looking for a fix running git clean worked for me.
git clean -fdx

@lavisar
Copy link

lavisar commented Dec 7, 2023

Hey everyone, for me the problem was the name of my folder which had an &. After deleting this character it worked fine

TY so much sir! I have spent 2 hours for this problem until I found your answer :)

p/s: just make sure your parents folder name dont have the "&"

@fwjyyds
Copy link

fwjyyds commented Feb 6, 2024

hey guys,my problem happened when i install some package but throw error,maybe it work if you install the package successfully.

@jamidwyer
Copy link

Anyone who's still looking for a fix running git clean worked for me.

git clean -fdx

This one worked for me! I had been experimenting with different build setups and I think removing a stray cache likely did the trick. Thank you thank you thank you!

@PherbCampton
Copy link

Delete the node_modules folder.
and then run npm install from powershell...

Worked smoothly for me.

@Ohnotech
Copy link

Ohnotech commented Mar 7, 2024

I had the same error using 16.13.0.
I tried to remove node_modules and install it again several times but didn't work properly.

Fortunately, I tried that practice again with new version * 21.4.0 (Currently using 64-bit executable) and it works well.

@oliviermartin
Copy link

I had the same issue on Linux and MacOS after migrating from npm to yarn for a React Native project.
Installing (and enabling) corepack.

  1. To install: npm install -g corepack or brew install corepack (I had to call brew unlink corepack)
  2. To enable corepack enable

In case you have this new error:

Internal Error: The "yarn-path" option has been set (in /Users/MyUser/myproject/.yarnrc.yml), but the specified location doesn't exist (/Users/MyUser/myproject/.yarn/releases/yarn-3.6.4.cjs).
    at i (/Users/MyUser/.cache/node/corepack/v1/yarn/3.6.4/yarn.js:446:11180)

Removing /Users/MyUser/myproject/.yarnrc.yml fixed the new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests