internal/modules/cjs/loader.js:582 throw err

前端 未结 25 1826
有刺的猬
有刺的猬 2020-11-27 04:24

I\'m getting following Console Error. Error : Cannot find module

Here is the full error i\'m getting in console. What should I do?



        
相关标签:
25条回答
  • 2020-11-27 05:02

    The path to the js file you're trying to execute is wrong; you have to type the path and the file name you want to execute relative to root where node is, but what you typed isn't where it is.

    I typed node redux-basics.js, got this slightly-misleading error message, Stack Overflow'ed, looked at my file system, and I should have typed node src/redux-basics.js.

    0 讨论(0)
  • 2020-11-27 05:05

    I had the same issue when I first tried on node js.
    I noticed this issue was happening to me because I had some .js files with same names in different directories, which were in the same main directory.
    I created another directory outside the main project folder, and created a .js file.
    After that, it ran fine.
    ex- app.js

    0 讨论(0)
  • 2020-11-27 05:05
    1. Delete the node_modules directory
    2. Delete the package-lock.json file
    3. Run npm install
    4. Run npm start

    OR

    rm -rf node_modules package-lock.json && npm install && npm start
    
    0 讨论(0)
  • 2020-11-27 05:05

    The particular .js file was in the sub folder (/src) of the application and Terminal was in general App folder.(which contains all package files,modules,public folder,src folder) it was throwing that error.Going to (/src) of application resolved my issue.

    0 讨论(0)
  • 2020-11-27 05:07

    it finally worked for me after I did sudo npm i cjs-loader (and make sure to install express, not just express-http-proxy)

    0 讨论(0)
  • 2020-11-27 05:08

    I uninstalled puppeteer, mocha and chai using

    npm uninstall puppeteer mocha chai
    

    from the command line and then reinstalled using

    npm install puppeteer mocha chai
    

    and the error message simply never showed up

    0 讨论(0)
提交回复
热议问题