question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

FATAL defu is not a function

See original GitHub issue

When I initialized the project with Nuxt2 and selected the chakra-ui then I got this error when I started, console show the error was in this package.

 FATAL  defu is not a function                                                                                                                   

  at ModuleContainer.module.exports (node_modules/@chakra-ui/nuxt/lib/module.js:20:32)
  at ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:239:34)
  at node_modules/@nuxt/utils/dist/utils.js:639:43
  at async ModuleContainer.ready (node_modules/@nuxt/core/dist/core.js:55:5)
  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:478:5)


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                       โ”‚
   โ”‚   โœ– Nuxt Fatal Error                  โ”‚
   โ”‚                                       โ”‚
   โ”‚   TypeError: defu is not a function   โ”‚
   โ”‚                                       โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chwan97commented, Oct 9, 2022

I do think this issue: #531 addresses the same issue. I do think you best install defu yourself as a dependency since it should be a peer dependency

Hope it helps ๐Ÿ˜Š

Thank you for your reply, I suppose defu 6.0.0 do have problem, turn @chakra-ui/nuxt 's version from ^0.6.0 to 0.5.0 solved this question.

0reactions
caocuong2404commented, Oct 10, 2022

Same problem with the first run. My package JSON files:

{
  "name": "demo-nuxtjs",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "lint:js": "eslint --ext \".js,.ts,.vue\" --ignore-path .gitignore .",
    "lint:prettier": "prettier --check .",
    "lint": "yarn lint:js && yarn lint:prettier",
    "lintfix": "prettier --write --list-different . && yarn lint:js --fix",
    "prepare": "husky install",
    "test": "jest"
  },
  "lint-staged": {
    "*.{js,ts,vue}": "eslint --cache",
    "*.**": "prettier --check --ignore-unknown"
  },
  "dependencies": {
    "@chakra-ui/nuxt": "^0.6.0",
    "@nuxt/content": "^1.0.0",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/emotion": "^0.1.0",
    "@nuxtjs/pwa": "^3.3.5",
    "core-js": "^3.25.3",
    "nuxt": "^2.15.8",
    "vue": "^2.7.10",
    "vue-server-renderer": "^2.7.10",
    "vue-template-compiler": "^2.7.10"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.19.1",
    "@commitlint/cli": "^17.1.2",
    "@commitlint/config-conventional": "^17.1.0",
    "@nuxt/types": "^2.15.8",
    "@nuxt/typescript-build": "^2.1.0",
    "@nuxtjs/eslint-config-typescript": "^11.0.0",
    "@nuxtjs/eslint-module": "^3.1.0",
    "@vue/test-utils": "^1.3.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^29.1.2",
    "eslint": "^8.24.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-jest": "^27.0.4",
    "eslint-plugin-nuxt": "^4.0.0",
    "eslint-plugin-vue": "^9.5.1",
    "husky": "^8.0.1",
    "jest": "^29.1.2",
    "jest-environment-jsdom": "^29.1.2",
    "lint-staged": "^13.0.3",
    "prettier": "^2.7.1",
    "ts-jest": "^29.0.3",
    "vue-jest": "^3.0.4"
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: "defuFn is not a function" in 3.0.0-rc.9-xx #7168 - GitHub
I solved it with adding defu dependencies "defu": "^6.1.0" in package.json for now. npm i defu.
Read more >
Issue "TypeError: external_defu_ is not a function" running ...
The solution is to transpile defu during the build: nuxt.config.js export default defineNuxtConfig({ // ... build: { transpile: [ 'defu', ]ย ...
Read more >
[h3] [unhandled] H3Error: __vite_ssr_import_0__.defineStore ...
defineStore is not a function at createError ... fatal: false, unhandled: true, statusMessage: 'Internal Server Error' }.
Read more >
reactjs Uncaught TypeError: j is not a function Code Example
โ€œreactjs Uncaught TypeError: j is not a functionโ€ Code Answer's ; uncaught TypeError: $.jajax is not a function. javascript by Easy Eel on...
Read more >
Defu Li's research works | Guangzhou Medical University ...
This page lists the scientific contributions of an author, who either does not have a ResearchGate profile, or has not yet added these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found