vue 报错Cannot read property ‘install‘ of undefined

vue 报错Cannot read property ‘install’ of undefined

  • vue 报错Cannot read property 'install' of undefined

vue 报错Cannot read property ‘install’ of undefined

本地npm run serve运行正常,但npm run build打包后,使用nginx代理,部署到宝塔上都报错

    server {
        listen       9001;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;


		location / {
            # 项目打包地址
            root   E:/Web/Vue/mundaneinn-front-end-plus/dist;
			try_files $uri $uri/ /index.html;
            index  index.html;
			add_header Access-Control-Allow-Origin *;
		}
		......

vue 报错Cannot read property ‘install‘ of undefined_第1张图片
网上找了很多原因都没成功,最后无奈只能把项目文件一个个的删,然后重新打包看有没有问题,自己的代码几乎都删完了,只剩index.vue没删了,打包还是出错。最后终于找到了问题在package.json里

  "devDependencies": {
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-router": "~5.0.0",
    "@vue/cli-plugin-vuex": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "less-loader": "^8.0.0",
    "postcss-import": "^14.1.0",
    "vue-template-compiler": "^2.6.14"
  },

这里5.0.0的会导致这个问题,没有找到原因,就是降低版本到4.5.0就行了。

  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "postcss-import": "^14.1.0",
    "vue-template-compiler": "^2.6.14"
  },

你可能感兴趣的:(Vue,vue.js,前端,javascript)