使用element-admin生成的项目;在新电脑重刻克隆出现的问题

扶隐水
2023-12-01

npm安装太慢;使用cnpm安装

npm install -g cnpm --registry=https://registry.npm.taobao.org

Cannot find module ‘@vue/babel-preset-app’

安装:

npm i @vue/babel-preset-app

Cannot find module ‘webpack’

安装:

cnpm i --save-dev webpack@4 webpack-cli

Cannot find module ‘util.promisify’

安装:

cnpm i util.promisify

Cannot find module ‘es-abstract/2021/CreateDataProperty’

安装:

cnpm i es-abstract

Cannot find module ‘cache-loader’

安装:

cnpm i cache-loader

依赖报错 core-js/library/fn/object/assign in ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/object/assign.js

解决方案
首先,升级core-js,执行命令npm install core-js@3 --save
然后再执行npm install async-validator@1.11.5 --save
若是还没有效果,那就再执行npm i -D babel-plugin-component
配置babel.config.js

module.exports = {
  "presets": [
    '@vue/cli-plugin-babel/preset',
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage",
        "corejs": 3
      }
    ]
  ],
  "plugins": [
    ["component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ],
  'env': {
    'development': {
      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
      'plugins': ['dynamic-import-node']
    }
  }
}

 类似资料: