LoginSignup
0
0

More than 1 year has passed since last update.

nodejsで何も読み込んでないのにMODULE_NOT_FOUNDするときの対処法

Last updated at Posted at 2022-10-31

先日から事情があってWSLが使えなくなったのでウィンドウズ側でNode.jsを触っていました。
とりあえずコンソールでハローワールドしようと思ったら、以下のエラーが

internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Function.executeUserEntryPoint [as runMain]    at node:internal/main/run_main_module:23:47 { 
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

調べてみたところ、C:\Users\{ユーザ名}\OneDrive以下のjsファイルにNode.jsを実行するとエラーが出るらしい。OneDrive下のマイドキュメントにスクリプトを置いていたので、C:\Users\{ユーザ名}\Documentsに移動したところ問題なく動きました。
(そもそもなんでドキュメントフォルダが二つあるんですかね...)

参考: https://stackoverflow.com/questions/72772684/module-not-found-nodejs

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0