解决module not found: error: can‘t resolve ‘path‘ in ‘C:\xxx\xxx‘

Console error

Solution

According to the prompts, there are two solution paths:
Method 1: Configure in module.exports in vue.config.js

  configureWebpack: {
    resolve: {
      fallback: {
        path: false,
      },
    },
  },

Method 2: npm i path-browserify, then configure it in module.exports in vue.config.js

  configureWebpack: {
    resolve: {
      fallback: {
        path: require.resolve('path-browserify'),
      },
    },
  },

**If method 2 is to enter npm i path-browserify in the console, the following error will be reported

Follow the prompts and replace npm i path-browserify with

npm install vue-router --force 或者 npm install vue-router --legacy-peer-deps

Guess you like

Origin blog.csdn.net/qq_54089372/article/details/127652316