Home > front end >  Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js):
Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js):

Time:10-06

i am working on a nuxtjs project and i suddenly got this warming error and i search to find a solution but i could not so if anyone can help me with this issue.

The error message looks like.

ERROR  in ./.nuxt/client.js                                                                                                                        friendly-errors 10:51:28

Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js):                                                     friendly-errors 10:51:28
Error: Cannot find module '@babel/plugin-proposal-private-property-in-object'
Require stack:

Here is my nuxt.config.js

build: {
    babel: {
      plugins: [
        ["@babel/plugin-proposal-private-methods", {loose: true}],
        ["@babel/plugin-proposal-private-property-in-object", {"loose": true}]
      ],
    }
  },

The package.json file

 "dependencies": {
    "@babel/preset-env": "^7.12.17",
    "core-js": "^3.8.3",
    "global": "^4.4.0",
    "module": "^0.0.1",
    "nuxt": "^2.13.3",
    "vue-scrollmagic": "^1.0.1"
  },
  "devDependencies": {
    "@babel/plugin-proposal-private-methods": "^7.14.5",
    "core-js-compat": "^3.4.7",
    "sass": "^1.42.1",
    "sass-loader": "^12.1.0",
    "webpack": "^5.56.0"
  }

Here is the entire error message

 ERROR  Failed to compile with 1 errors                                                                                                             friendly-errors 10:51:28


 ERROR  in ./.nuxt/client.js                                                                                                                        friendly-errors 10:51:28

Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js):                                                     friendly-errors 10:51:28
Error: Cannot find module '@babel/plugin-proposal-private-property-in-object'
Require stack:
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/files/plugins.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/files/index.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/index.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/loader-runner/lib/loadLoader.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/loader-runner/lib/LoaderRunner.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/webpack/lib/NormalModule.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/webpack/lib/Compiler.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/node_modules/webpack/lib/webpack.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/webpack/dist/webpack.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/cli/dist/cli-index.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@nuxt/cli/dist/cli.js
- /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/nuxt/bin/nuxt.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at resolve (internal/modules/cjs/helpers.js:94:19)
    at resolveStandardizedName (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/files/plugins.js:111:7)
    at resolvePlugin (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/files/plugins.js:55:10)
    at loadPlugin (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/files/plugins.js:63:20)
    at loadPlugin.next (<anonymous>)
    at createDescriptor (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/config-descriptors.js:187:16)
    at createDescriptor.next (<anonymous>)
    at step (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/gensync/index.js:261:32)
    at evaluateAsync (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/gensync/index.js:291:5)
    at /Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/gensync/index.js:44:11
    at Array.forEach (<anonymous>)
    at Function.async (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/gensync/index.js:43:15)
    at Function.all (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/gensync/index.js:216:13)
    at Generator.next (<anonymous>)
    at createDescriptors (/Users/princebolampembe/MyWork/GithubKusunoki/twin_frontend_copy/twin/node_modules/@babel/core/lib/config/config-descriptors.js:142:41)
                                                                                                                                                    friendly-errors 10:51:28
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js eventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&path=/__webpack_hmr/client&name=client ./.nuxt/client.js

I tried to install @babel/preset-even 7.12.17 but i did not work the entire code looks nice but the issue this going on and i am still more research but if anyone find something please let me know. Thank I'm working in Nuxt.js version"1.0.0"

CodePudding user response:

It looks like the version of @babel/preset-evn that you're using (7.12.17) doesn't include @babel/plugin-proposal-private-property-in-object. Either try adding it explicitly (to package.json, not just your nuxt config), or update to a newer babel preset; the latest version, 7.15.6, does include the plugin you're after.

CodePudding user response:

Thanks guys i could find a solution it was the old nuxt.js version so i removed my node_modules file i removed my package-lock.json file i run npm install and then i run npm outdated afte i run my dev normally and that works perfectly.

  • Related