Cannot find module '@babel/core'

后端 未结 12 572
再見小時候
再見小時候 2021-01-30 16:01

I am following along with this webpack4/react tutorial:

https://www.youtube.com/watch?v=deyxI-6C2u4

I have followed it exactly up until the part where he runs np

相关标签:
12条回答
  • 2021-01-30 16:12

    In my case I had to uninstall babel 6

    npm uninstall --save-dev babel-cli  babel-core babel-polyfill babel-preset-es2015 babel-preset-stage-2 babel-register
    

    and then reinstall babel 7

    npm i  --save-dev  @babel/cli  @babel/core @babel/node  @babel/polyfill  @babel/preset-env
    

    and it worked for me.

    0 讨论(0)
  • 2021-01-30 16:12

    I am able to fix this issue using below command

    npm install @babel/core --save
    
    0 讨论(0)
  • 2021-01-30 16:12

    Go in by running on Windows, %USERPROFILE%\.quokka

    The ~/.quokka configuration is limited to the config.json file and any packages that exist in ~/quokka/node_modules.

    Put the following into config.js,

    {
      "pro":true, 
      "babel": {
        "presets": ["@babel/preset-env", " @babel/preset-react"],
        "plugins": [
          ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
          ["@babel/plugin-proposal-decorators", { "legacy": true }],
          ["@babel/plugin-proposal-class-properties", { "loose": true }]
        ]
      }
    }
    
    0 讨论(0)
  • 2021-01-30 16:14

    babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.

    0 讨论(0)
  • 2021-01-30 16:14

    try to install npm install @babel/core --save if it does not work try to uninstall node_modules and reinstall

    0 讨论(0)
  • 2021-01-30 16:14

    I've been dealing with this problem for a few hours and it mysteriously disappeared when I added a "devDependencies" section to my package.json file and moved the @types dependencies to it.

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