Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuxt3 引入报错 #1427

Closed
zuohuadong opened this issue Oct 23, 2021 · 4 comments
Closed

nuxt3 引入报错 #1427

zuohuadong opened this issue Oct 23, 2021 · 4 comments
Labels
untriaged need to sort

Comments

@zuohuadong
Copy link

zuohuadong commented Oct 23, 2021

TuSimple/naive-ui version (版本)

2.19.11

Vue version (Vue 版本)

3.2.20

Browser and its version (浏览器及其版本)

chrome 93

System and its version (系统及其版本)

Windows 11

Node version (Node 版本)

16

Reappearance link (重现链接)

https://github.com/nuxt/nuxt.js

Reappearance steps (重现步骤)

npm i -D naive-ui
import { NCarousel } from 'naive-ui'
npm run dev -- -o

Expected results (期望的结果)

正常引入,支持 ssr

Actual results (实际的结果)

(node:2320) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap. (node:internal/modules/esm/translators:196:29)
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async instantiateModule (file:///D:/Qsync/workspace/guanwang/nuxt-app/.nuxt/dist/server/server.mjs:2717:3)

Remarks (补充说明)

类似:productdevbook/oku-nuxt3-template#1

@github-actions github-actions bot added the untriaged need to sort label Oct 23, 2021
@greenhat616
Copy link
Contributor

是不是你自己的项目在package里面没有设置 type: "module"

@hzm18
Copy link

hzm18 commented Oct 25, 2021

同样遇到了这个问题

@07akioni
Copy link
Collaborator

参考一下 #636

@Talljack
Copy link
Contributor

ref #636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

5 participants