javascript npm install vue 3 return ERR!无法将undefined或null转换为object

n3schb8v  于 2023-03-28  发布在  Java
关注(0)|答案(1)|浏览(167)

我的项目有问题,我尝试使用npm install,但这返回了所有这些警告和错误npm ERR! Cannot convert undefined or null to object。我的项目在vuew 3中

PS C:\DEV C\keyappfront> npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: postcss-load-config@3.1.4
npm WARN Found: postcss@7.0.39
npm WARN node_modules/postcss
npm WARN dev postcss@"^7.0.39" from the root project
npm WARN 46 more (@intervolga/optimize-cssnano-plugin, …)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional postcss@">=8.0.9" from postcss-load-config@3.1.4
npm WARN node_modules/postcss-load-config
npm WARN postcss-load-config@"^3.1.0" from @tailwindcss/postcss7-compat@2.2.17
npm WARN node_modules/@tailwindcss/postcss7-compat
npm WARN 1 more (tailwindcss)
npm WARN
npm WARN Conflicting peer dependency: postcss@8.4.18
npm WARN node_modules/postcss
npm WARN peerOptional postcss@">=8.0.9" from postcss-load-config@3.1.4
npm WARN node_modules/postcss-load-config
npm WARN postcss-load-config@"^3.1.0" from @tailwindcss/postcss7-compat@2.2.17
npm WARN node_modules/@tailwindcss/postcss7-compat
npm WARN 1 more (tailwindcss)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: vue-class-component@7.2.6
npm WARN Found: vue@3.2.39
npm WARN node_modules/vue
npm WARN vue@"^3.0.0" from the root project
npm WARN 12 more (@headlessui/vue, @heroicons/vue, …)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^2.0.0" from vue-class-component@7.2.6
npm WARN node_modules/vue-property-decorator/node_modules/vue-class-component
npm WARN vue-class-component@"^7.1.0" from vue-property-decorator@8.5.1
npm WARN node_modules/vue-property-decorator
npm WARN
npm WARN Conflicting peer dependency: vue@2.7.13
npm WARN node_modules/vue
npm WARN peer vue@"^2.0.0" from vue-class-component@7.2.6
npm WARN node_modules/vue-property-decorator/node_modules/vue-class-component
npm WARN vue-class-component@"^7.1.0" from vue-property-decorator@8.5.1
npm WARN node_modules/vue-property-decorator
npm ERR! Cannot convert undefined or null to object

我在我的package.json中有此配置,我删除了node_modules文件夹并尝试再次安装,但问题仍然存在,我尝试在package.json中更新软件包的版本,如"vue-property-decorator": "^8.5.1",,但问题仍然存在。

{
  "name": "vue3",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@headlessui/vue": "^1.0.0",
    "@heroicons/vue": "^1.0.1",
    "@j-t-mcc/vue3-chartjs": "^1.2.0",
    "axios": "^0.21.4",
    "chart.js": "^3.6.0",
    "core-js": "^3.6.5",
    "lodash": "^4.17.21",
    "moment": "^2.29.4",
    "vee-validate": "^4.7.1",
    "vue": "^3.0.0",
    "vue-property-decorator": "^8.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0",
    "vuex-persist": "^3.1.3",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@tailwindcss/postcss7-compat": "^2.2.17",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/test-utils": "^2.0.0-0",
    "autoprefixer": "^9.8.6",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0",
    "postcss": "^7.0.39",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
    "typescript": "~3.9.3",
    "vue-jest": "^5.0.0-0"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {},
    "overrides": [
      {
        "files": [
          "**/__tests__/*.{j,t}s?(x)",
          "**/tests/unit/**/*.spec.{j,t}s?(x)"
        ],
        "env": {
          "jest": true
        }
      }
    ]
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ],
  "jest": {
    "preset": "@vue/cli-plugin-unit-jest",
    "transform": {
      "^.+\\.vue$": "vue-jest"
    }
  }
}

你有什么想法或建议来解决这个问题吗?我真的需要它,谢谢!

5kgi1eie

5kgi1eie1#

这里问题是使用了与nodejs中的库类似的名称,我只是更改了这个

{
  "name": "vue3",
}

然后重新安装npm i,并更改我的项目名称,所有工作再次!

相关问题