nodejs module.js:340 error: cannot find module

前端 未结 21 572
别那么骄傲
别那么骄傲 2021-02-02 06:39

I installed nodejs in C:\\Program Files (x86)\\nodejs

then I created a .js file and saved it in my desktop just to output \'hello world\' in the console:



        
相关标签:
21条回答
  • 2021-02-02 07:17

    I think the issue is the NODE_PATH environment variable. I had the same problem but once I issued (on Windows)

    set NODE_PATH=C:\Users\MyUser\node_modules
    

    then all worked ok.

    Cheers,

    0 讨论(0)
  • 2021-02-02 07:17

    In my case, i got this error because i was just in the wrong directory. So node couldnt find the module that i wanted to run. Just be sure your node file is in your Desktop directory.

    0 讨论(0)
  • 2021-02-02 07:20

    I executed following command and it works for me.

    PM> npm install ee-first ee-first@1.1.0 node_modules\ee-first
    
    0 讨论(0)
提交回复
热议问题