Quantcast
Viewing all articles
Browse latest Browse all 8691

#node command run script file – Error: Cannot find module '/not-exist-file.js' ( internal/modules/cjs/loader.js )

  • 存在しないファイルを実行しようとした時に、このエラーが発生した
  • 実行ファイルを指定するとモジュール扱いになる?
  • あまり親切なメッセージで教えてくれたりはしないっぽい
$ node --version
v12.16.1

$ node /not-exist-file.js
internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module '/not-exist-file.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/3127


Viewing all articles
Browse latest Browse all 8691

Trending Articles