nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 280 forks source link

node.js cannot find module on a mac!!! #4333

Closed Nemeswat closed 3 months ago

Nemeswat commented 8 months ago

Details

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

Error: Cannot find module '/Users/mac/deposit.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.11.0
mac@macs-Air-2 ~ %   

Node.js version

Node.js v20.11.0

Example code

node deposit.js yyiecymjvwYE6Wxg4ZSt4ibdfFRo3JUNhQ99AKnaRqu 0x7C9e161ebe55000a3220F972058Fb83273653a6e 1500000 100 3e1bf180e4778c7944f509b422711101186d26ac15337934f12088623755c0b7 https://rpc.sepolia.org/

Operating system

macOS

Scope

code

Module and version

Not applicable.

veerasrikanthv commented 8 months ago

Facing same issue

VoltrexKeyva commented 7 months ago

Have you tried checking if /Users/mac/deposit.js actually exists? You're likely trying to run your JavaScript file from the incorrect directory. /Users/mac is your home directory and your JS file is most likely not there, double-check to make sure and if it's not there then either change your directory to where your JS file actually is using the cd command or specify the correct path to the JS file.

aqifkhan12 commented 7 months ago

Facing same issue

aqifkhan12 commented 7 months ago

Have you tried checking if /Users/mac/deposit.js actually exists? You're likely trying to run your JavaScript file from the incorrect directory. /Users/mac is your home directory and your JS file is most likely not there, double-check to make sure and if it's not there then either change your directory to where your JS file actually is using the cd command or specify the correct path to the JS file.

I am using windows, and my android folder exists, but still facing same issue image

RedYetiDev commented 4 months ago

Hi! Is this issue still outstanding?

Make sure the file to run exists and is executable.