Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

288
Vistas
how do i solve this error while running javascript in my node.js?

i want to run my script "script.js" on node.js use command "node script.js" but i got this error

  node:internal/modules/cjs/loader:936
  throw err;
  ^
    Error: Cannot find module 'C:\Users\User\script.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:79:12)[39m
    [90m    at node:internal/main/run_main_module:17:47[39m {
      code: [32m'MODULE_NOT_FOUND'[39m,
      requireStack: []
    }

can anyone help ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Please ensure that you are running the node command in the same folder that the script.js file exist. If you are opening command prompt from a different location and try running node script.js, an error will be thrown as

internal/modules/cjs/loader.js:883 throw err; ^

Error: Cannot find module 'C:\yourpath\script.js' [90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)[39m [90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)[39m [90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)[39m [90m at internal/main/run_main_module.js:17:47[39m { code: [32m'MODULE_NOT_FOUND'[39m, requireStack: [] }

This indicates that the file doesnot exist in the desired path.

As per your question, you are running the command from C:\Users\User, so your script.js file must be there at the location C:\Users\User\script.js. If your script.js is at some other location, say C:\Users\yourusername\somerandomfolderpath, then you have to open your command prompt at that folder or go to that location using command prompt using these commads.

C:
cd C:\Users\yourusername\somerandomfolderpath

The first command takes you to the required drive (expecting it to be C drive here). The second command takes to the required folder in that drive.

After this you can run your script using.

node script.js
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda