【问题标题】:Nuxt3 with VueUse Motion 'Cannot start nuxt: Package subpath './nuxt' is not defined by "exports"'Nuxt3 with VueUse Motion \'Cannot start nuxt: Package subpath \'./nuxt\' is not defined by \"exports\"\'
【发布时间】:2022-10-18 19:19:48
【问题描述】:

我一直在尝试将VueUse Motion 与 Nuxt3 一起使用。我已经按照文档安装了@vueuse/motio,然后将'@vueuse/motion/nuxt' 添加到我的nuxt.config.ts 文件中。 但是当我想运行开发服务器时,它会产生这个错误:

Cannot start nuxt: Package subpath './nuxt' is not defined by "exports" in C:\Users\orhan\Desktop\p3\node_modules\@vueuse\motion\package.json

这是我在nuxt.config.ts 中的模块

  modules: [
    '@nuxtjs/i18n',
    '@nuxtjs/tailwindcss',
    '@vueuse/nuxt',
    '@pinia/nuxt',
    '@vueuse/motion/nuxt',
  ],

我的package.json 文件:

  "devDependencies": {
    "@iconify/json": "^2.1.116",
    "@nuxt/types": "^2.15.8",
    "@nuxtjs/google-fonts": "^3.0.0-0",
    "@nuxtjs/tailwindcss": "^5.3.3",
    "@tailwindcss/typography": "^0.5.7",
    "@vueuse/motion": "^2.0.0-beta.12",
    "nuxt": "3.0.0-rc.11",
    "prettier": "^2.7.1",
    "prettier-plugin-tailwindcss": "^0.1.13",
    "sass": "^1.55.0",
    "sass-loader": "^13.0.2",
    "unplugin-icons": "^0.14.11",
    "unplugin-vue-components": "^0.22.7"
  },
  "dependencies": {
    "@nuxtjs/i18n": "^8.0.0-alpha.2",
    "@pinia/nuxt": "^0.4.2",
    "@vueuse/nuxt": "^9.3.0",
    "daisyui": "^2.31.0"
  }

【问题讨论】:

    标签: nuxtjs3 vueuse


    【解决方案1】:

    您使用的 nuxt 版本 (3.0.0-rc.11) 与 @vueuse/motion@2.0.0-beta.12 存在兼容性问题。

    解决方案:

    在您的package.json 中,只需尝试将"@vueuse/motion": "^2.0.0-beta.12" 更改为"@vueuse/motion": "^2.0.0-beta.23"

    然后运行pnpm installpnpm dev

    【讨论】:

      【解决方案2】:

      我可以确认@Mahdi Shooreshi 的回答对我有用,没有足够的声誉来投票或发表评论

      我的设置类似于 OP

      • nuxt3

      【讨论】:

        猜你喜欢
        • 2023-01-24
        • 2022-11-20
        • 2015-04-29
        • 2021-11-09
        • 2016-11-22
        • 2021-12-05
        • 2022-10-24
        • 2020-08-03
        • 2017-08-06
        相关资源
        最近更新 更多