Javascript code is not running show module not found

**Question:

Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:

code snippet

Please give us a link to the repl where the error occurs or provide us with the part of the code that causes this error. If your error is related to the prompt function, check out this post:

1 Like

i just write simple code
console.log(“hellow”);
and they show module not found

Are you running this code in the Console, or in a file? If it’s in the Console, you can no longer run code that way since Replit has removed prybar.

1 Like

i’m writting this code in node.js file and console show me module not found

1 Like

Could you share a link to your Repl?

my code is work only in index.js file if i want make a new file like tut1.js and write my code in new file it show module not found is that possible to run my code in my new file insted of index.js file

These steps should help you with that:

Just click the next to “Files” then click “Show hidden files”. Next click on the .replit file and finally you can change the entrypoint to whatever file you want to run.

Images

Dots

Show hidden files

edited

You should also see the docs on how to configure a Repl: https://docs.replit.com/programming-ide/configuring-repl

And if you want to run the last edited file, take a look at this post:

1 Like

what should i put in entry point so that my javascript will run on any file name because i am beginner so ihave to make lots of javascipt file plese tell me i want like this examples:
tut1.js tut2.js tut3.js

Hi @Abhishek-Rawat1 ! It depends on which file you want to run.

1 Like

so it means i have to change entrypoint everytime

You could use the onboot code, which will set the entry point to your last edited file for you.

onboot code where i’ll find

You’ll have to add the block of code I shared above to your .replit file.

.replit file has already a code .
remove the old code and copy the new one …?

Just add the above onboot code to the top of the file.

entrypoint = "index.js"
modules = ["nodejs-18:v3-20230608-f4cd419"]
hidden = [".config", "package-lock.json"]

[nix]
channel = "stable-23_05"

[deployment]
run = ["node", "index.js"]
deploymentTarget = "cloudrun"
ignorePorts = false

this is .replitfile tell me where i can add the onboot code

Add the code above this line.

onBoot = '''/nix/store/fbi9r30p3lqk96lmw5b1v1bpbj62cr2l-inotify-tools-3.20.11.0/bin/inotifywait -rqme create --format=%f%w --include='\..+\.py.[0-9]+~' .|while
read f
do
f=${f#.}
o=
r=
while
read -r l||[ "$l" ]
do
case $r
in
"")case $l
in entrypoint*)m="${l%\"*\"}\"${f#*~./}${f%.*~*}\""
case $m
in
"$l")break
esac
l=$m
r=1
esac
esac
o="$o$l
"
false
done<.replit||echo -n "$o">.replit
done'''
entrypoint = "index.js"
modules = ["nodejs-18:v3-20230608-f4cd419"]
hidden = [".config", "package-lock.json"]

[nix]
channel = "stable-23_05"

[deployment]
run = ["node", "index.js"]
deploymentTarget = "cloudrun"
ignorePorts = false

like this

That should work, yes. Make sure to run kill 1 in the Shell after you do that.

Make sure to change .py on line one to .js though!