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

Nuxt project build failed with: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './nuxt' is not defined by "exports" in vue-sweetalert2\package.json #160

Open
kokhoor opened this issue May 16, 2024 · 10 comments
Labels

Comments

@kokhoor
Copy link

kokhoor commented May 16, 2024

Describe the bug
When building my nuxt project that includes vue-sweetalert2 using yarn, the build failed with following error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './nuxt' is not defined by "exports" in vue-sweetalert2\package.json

we import vue-sweetalert2 in nuxt.config.js:
modules: [
// https://go.nuxtjs.dev/bootstrap
"bootstrap-vue/nuxt",
"vue-sweetalert2/nuxt"
],

To fix it, I had to manually change:

node_modules/vue-sweetalert2/package.json by adding:

"./nuxt": "./nuxt/index.js"

to:

"exports": {
".": {
"import": "./dist/vue-sweetalert.mjs",
"require": "./dist/vue-sweetalert.umd.js",
"types": "./dist/index.d.ts",
"default": "./dist/vue-sweetalert.js"
},
"./nuxt": "./nuxt/index.js" // added this line
}

If there is a solution where we don't have to change package.json will be ideal.

I also want to know

@kokhoor kokhoor added the bug label May 16, 2024
@davidVenegas
Copy link

Yes, I have the same problem but I can't change the package.json because I'm creating a docker image

@mohsin
Copy link

mohsin commented May 18, 2024

Same issue +1

@wanarsanPhaiii
Copy link

Same +1

1 similar comment
@lifan2029
Copy link

Same +1

@avil13
Copy link
Owner

avil13 commented May 22, 2024

Hi all.
Nuxt support has been made for version 2.
It has not been added for v3 yet.
You can just use sweetalert2 as a library.

@caglarduman
Copy link

Same +1
It was working without any issues until now. As of this week, we started receiving this error.

"nuxt": "^2.15.7"
"vue-sweetalert2": "^5.0.2"

@avil13
Copy link
Owner

avil13 commented May 30, 2024

@caglarduman Update to the latest version. And if there is an error, please send the log.

@thanhdanh2604
Copy link

thanhdanh2604 commented May 30, 2024

Hello, I encountered the same issue. I attempted to change my Node.js version from 18 to 16.20.2, and it resolved the error.
Don't know why

@caglarduman
Copy link

@avil13

When I used the "^" symbol in the "vue-sweetalert2": "^5.0.2" line in the package.json, it automatically used version 5.0.10, which is the latest released version. I removed the "^" symbol and forced it to use version 5.0.2. The issue was resolved. I think the problem was in the latest version.

@avil13
Copy link
Owner

avil13 commented Jun 4, 2024

@caglarduman I apologize for taking so long. Can you look up version 5.0.11?

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

No branches or pull requests

8 participants