错误无法读取未定义的属性(读取“钩子”)VueJS、Nuxt、Npx

问题描述 投票:0回答:1

我已经在笔记本电脑上下载并设置了现有的旧代码,并执行了

npm install
安装必要的软件包,并执行
npm audit fix --force
解决了漏洞。当我这样做时
npm run start
它给出了错误

Error: Cannot find module 'C:\Work\Xampp\htdocs\folder-name\node_modules\nuxt\bin\nuxt.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

当我运行

npm run dev
时,它会告诉我运行
npx nuxi dev
或使用
npx nuxi ---

运行其他命令

现在当我运行

npx nuxi dev
时,它会给出以下错误

ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'hook')                                                                           18:25:30

  at nuxtBootstrapVue (node_modules\bootstrap-vue\nuxt\index.js:34:13)
  at installModule (/C:/Work/Xampp/htdocs/folder-name/node_modules/@nuxt/kit/dist/index.mjs:416:9)
  at async initNuxt (/C:/Work/Xampp/htdocs/folder-name/node_modules/nuxt/dist/index.mjs:1825:7)
  at async load (/C:/Work/Xampp/htdocs/folder-name/node_modules/nuxi/dist/chunks/dev.mjs:6779:9)
  at async Object.invoke (/C:/Work/Xampp/htdocs/folder-name/node_modules/nuxi/dist/chunks/dev.mjs:6840:5)
  at async _main (/C:/Work/Xampp/htdocs/folder-name/node_modules/nuxi/dist/cli.mjs:50:20)

面对

ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'hook')
当尝试运行命令
npx nuxi dev
时,我也尝试删除并重新安装节点模块

node.js nuxt.js vuejs3 nuxtjs3 npx
1个回答
0
投票

如果有人仍然遇到此错误,请更改您的 nuxt.config.js

export default {
  // your code
}

import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig{
  // your code
}

为我解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.