Closed melrefaie closed 2 years ago
May be fixed in #8144 , you can try the latest version v2.2.5
I still have the same issue, I have the version 2.2.8 running on Ubuntu
still have the same issue, I have the version 2.2.13 running dev locally
still have the same issue, I have the version 2.2.14 running dev locally
still have the same issue, I have the version 2.2.17 running dev locally
still have the same issue, I have the version 2.2.17 running dev locally
still have the same issue, I have the version 2.2.18 running dev locally
The error cannot be reproduced using the element-plus-nuxt-starter
@tolking 重现办法
package.json
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"nuxt": "3.0.0-rc.11",
"unplugin-vue-components": "^0.22.8"
},
"dependencies": {
"element-plus": "^2.2.18"
}
}
nuxt.config.ts
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineNuxtConfig({
build: {
transpile: ['element-plus/es']
},
vite: {
plugins: [
Components({
resolvers: [ElementPlusResolver()]
})
]
}
})
app.vue
<template>
<div>
<el-button type="primary">test</el-button>
</div>
</template>
At present, the dayjs is based on CommonJS Modules. It seems that there is a conflict when you use unplugin-vue-components
like this. Maybe you need to manually introduce required components like template. Wait for the dayjs dependency upgrade to 2.0.
still have the same issue, I have the version 2.2.19 running dev locally
Still have this issue!
I can not reproduce this issue by element-plus-nuxt-starter, can you provide a demo?
I still have this issue on 2.3.7, and I check code in element plus, there are still some improts like import type { Dayjs } from 'dayjs'
ERROR Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function 00:31:08
ERROR _dayjs.default.extend is not a function 00:31:08
at node_modules/element-plus/es/components/time-picker/src/time-picker.mjs:10:16
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/time-picker/index.mjs:1:2184
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/src/date-table.mjs:2:1
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/src/date-table2.mjs:3:18
ERROR Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function 00:28:11
ERROR _dayjs.default.extend is not a function 00:28:11
at node_modules/element-plus/es/components/time-picker/src/time-picker.mjs:10:16
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/time-picker/index.mjs:1:2184
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/src/date-table.mjs:2:1
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/src/date-table2.mjs:3:18
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/src/calendar2.mjs:4:41
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/components/calendar/index.mjs:2:40
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/element-plus/es/component.mjs:9:15
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at node_modules/@element-plus/nuxt/dist/module.mjs:2:41
at evalModule (node_modules/jiti/dist/jiti.js:1:255106)
at jiti (node_modules/jiti/dist/jiti.js:1:253034)
at requireModule (node_modules/@nuxt/kit/dist/index.mjs:2244:26)
at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2435:90)
at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2408:47)
at async initNuxt (node_modules/nuxt/dist/index.mjs:3231:7)
at async loadNuxt (node_modules/nuxt/dist/index.mjs:3304:5)
at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2537:19)
at async Object.invoke (node_modules/nuxi/dist/chunks/prepare.mjs:31:18)
at async _main (node_modules/nuxi/dist/cli.mjs:49:20)
still have the same issue, I have the version 3.6.2 running dev locally
try delete package-lock.json
and reinstall packages, it works for me.
still have the same issue, I have the version 2.4.1 running dev locally
node = 18.18.2 os = macOS big sur 11.6.3 Version Details
"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxtjs/google-fonts": "^3.0.2",
"@pinia-plugin-persistedstate/nuxt": "^1.1.2",
"nuxt": "^3.7.0"
},
"dependencies": {
"@element-plus/nuxt": "^1.0.5",
"@iconify/json": "^2.2.116",
"@nuxt/ui": "^2.8.1",
"@pinia/nuxt": "^0.4.11",
"bootstrap": "^5.2.3",
"pinia": "^2.1.6",
"sass": "^1.66.1",
"sass-loader": "^13.3.2",
"vue-select": "^3.20.2",
"vue3-otp-input": "^0.4.1"
},
I am still facing same proble in postinstall
command
Using default Tailwind CSS file nuxt:tailwindcss 12:34:14 AM
ERROR Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function 12:34:15 AM
ERROR _dayjs.default.extend is not a function 12:34:15 AM
at node_modules/element-plus/es/components/time-picker/src/time-picker.mjs:10:16
at evalModule (node_modules/jiti/dist/jiti.js:1:255614)
at jiti (node_modules/jiti/dist/jiti.js:1:253542)
at node_modules/element-plus/es/components/time-picker/index.mjs:1:2184
at evalModule (node_modules/jiti/dist/jiti.js:1:255614)
at jiti (node_modules/jiti/dist/jiti.js:1:253542)
at node_modules/element-plus/es/components/calendar/src/date-table.mjs:2:1
at evalModule (node_modules/jiti/dist/jiti.js:1:255614)
at jiti (node_modules/jiti/dist/jiti.js:1:253542)
at node_modules/element-plus/es/components/calendar/src/date-table2.mjs:3:18
ERROR _dayjs.default.extend is not a function 12:34:15 AM
npm ERR! code 1
npm ERR! path my-project-path
npm ERR! command failed
npm ERR! command sh -c nuxt prepare
npm ERR! A complete log of this run can be found in: /Users/lenovo/.npm/_logs/2023-10-25T19_04_09_552Z-debug-0.log
same issue in a new nuxt project, any solution?
ERROR Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function 19:21:46
ERROR Cannot start nuxt: _dayjs.default.extend is not a function 19:21:46
at
there is still the original problem, why was this issue closed?
I can not reproduce this issue in the element-plus-nuxt-starter, can you provide a demo?
perhaps you can reinstall or update the dependencies
there is still the original problem, why was this issue closed?
ERROR Error while requiring module @element-plus/nuxt: TypeError: _dayjs.default.extend is not a function
ERROR _dayjs.default.extend is not a function
at node_modules/element-plus/es/components/time-picker/src/time-picker.mjs:10:16
at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
at jiti (node_modules/jiti/dist/jiti.js:1:254371)
at node_modules/element-plus/es/components/time-picker/index.mjs:1:2184
at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
at jiti (node_modules/jiti/dist/jiti.js:1:254371)
at node_modules/element-plus/es/components/calendar/src/date-table.mjs:2:1
at evalModule (node_modules/jiti/dist/jiti.js:1:256443)
at jiti (node_modules/jiti/dist/jiti.js:1:254371)
at node_modules/element-plus/es/components/calendar/src/date-table2.mjs:3:18
ERROR _dayjs.default.extend is not a function
I've never reproduced this issue. You can use element-plus-nuxt-starter testing, or provide a demo that can reproduce this issue.
I've reproduced it here: https://stackblitz.com/edit/github-spueta?file=app.vue
Please note that the code about time picker is in app.vue
:
<ElDatePicker />
Also, there are two package-lock.json
file, one is named as package-lock-backup.json
. This issue will be reproduced with package-lock.json
and not with package-lock-backup.json
Commands:
rm -r node_modules .nuxt
npm i
npx nuxt prepare
Please note that this may not be produced on Windows
Sorry, I am unable to run the demo you provided properly. (macos 14, node 21.2.0)
Cannot find module './shared/untyped.a47b2336.cjs'
When I convert the package-lock.json
file through pnpm import
, it can run normally in pnpm.
pnpm import package-lock.json
//.npmrc
shamefully-hoist=true
strict-peer-dependencies=false
shell-emulator=true
legacy-peer-deps=true
Since you have provided a lock file that run normally, perhaps the cause of the issues is related to the installation dependencies.
Please reproduce it in stackblitz, I also cannot reproduce it on local machine.
Yes I agree that may related to dependencies, and the elemen-plus version remains the same, but it's hard to locate the issue.
在nuxt.config.ts中,加入配置项
export default defineNuxtConfig({
ssr: true,
build: {
transpile: ['element-plus/es', 'loadsh'],
},
})
这个对我有用!
我的版本是:"element-plus": "^2.6.1", "@element-plus/nuxt": "^1.0.7",
If you encounter this issues, you can try adding dayjs
to the nuxt.config
export default defineNuxtConfig({
vite: {
optimizeDeps: {
include: ['dayjs', 'dayjs/plugin/*']
}
}
})
dayjs
If you encounter this issues, you can try adding
dayjs
to thenuxt.config
export default defineNuxtConfig({ vite: { optimizeDeps: { include: ['dayjs', 'dayjs/plugin/*'] } } })
It's still keep the same issue.
It still keeps the same issue.
same error
Please reproduce it in stackblitz, I also cannot reproduce it on local machine.
Yes I agree that may related to dependencies, and the elemen-plus version remains the same, but it's hard to locate the issue.
If I update the dependencies on my nuxt 3 project I get this error
Currently, I have version 3.11.2 of Nuxt 3, with element-plus/nuxt@1.0.7, wich pulls element-plus@2.5.5
But the update gives me element-plus/nuxt@1.0.8 with element-plus@2.7.0 which doesn't work and blows up just like the error in the image above.
dayjs is the same, 1.11.10
I fixed it, I can't just use element-plus or dayjs-nuxt model, you need install dayjs too,
pnpm install dayjs
and fix.
That didn't do the trick for me...
Is anybody else still having the same issue?
Running 'pnpm install dayjs' is useful
For those who are still struggling with this nasty problem, migrating from pnpm to yarn 4 solved the issue for me
Bug Type:
Other
Environment
3.2.33
2.2.4
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Nuxt
Reproduction
Related Component
All
Reproduction Link
CodeSandbox
Steps to reproduce
add element-plus to fresh nuxt project. example in codesandbox https://codesandbox.io/s/wizardly-wilbur-e7ngpy?file=/app.vue:0-1097
What is Expected?
expected to work in development with no errors. it works fine in build.
What is actually happening?
what happen that i got this error
you can see error in console https://e7ngpy.sse.codesandbox.io/
and js dont work. components appear fine but not working.
Additional comments
I tried starter repo but it have issues. https://github.com/element-plus/element-plus-nuxt-starter/issues/34