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

[npm] when use npm, postinstall hook get error #70

Closed
genffy opened this issue Sep 4, 2023 · 4 comments
Closed

[npm] when use npm, postinstall hook get error #70

genffy opened this issue Sep 4, 2023 · 4 comments

Comments

@genffy
Copy link
Contributor

genffy commented Sep 4, 2023

when use npm as package manger tool, run postinstall script(nuxi prepare) got build error.
reproduction step

  • clone repo
  • npm i

error detail

➜  element-plus-nuxt-starter git:(main) npm i

> element-plus-nuxt-starter@0.1.0 postinstall
> nuxi prepare


 ERROR  Cannot find module 'pinia/dist/pinia.mjs'                                                                                                                11:27:16 AM
Require stack:
- /Users/<username>/workspace/github/element-plus-nuxt-starter/index.js

  Require stack:
  - index.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
  at Function.resolve (node:internal/modules/cjs/helpers:116:19)
  at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:250196)
  at resolveModule (node_modules/@nuxt/kit/dist/index.mjs:2239:29)
  at setup (node_modules/@pinia/nuxt/dist/module.mjs:26:60)
  at normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2141:37)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2426:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:3522:7)
  at async loadNuxt (node_modules/nuxt/dist/index.mjs:3605:5)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2571:19) 



 ERROR  Cannot find module 'pinia/dist/pinia.mjs'                                                                                                                11:27:16 AM
Require stack:
- /Users/<username>/workspace/github/element-plus-nuxt-starter/index.js

dependecy detail

➜  element-plus-nuxt-starter git:(main) ✗ npm list
element-plus-nuxt-starter@0.1.0 /Users/<username>/workspace/github/element-plus-nuxt-starter
├── @element-plus/icons-vue@2.1.0
├── @element-plus/nuxt@1.0.5
├── @nuxtjs/color-mode@3.3.0
├── @pinia/nuxt@0.4.11
├── @unocss/nuxt@0.53.6
├── @vueuse/nuxt@10.4.1
├── consola@3.2.3
├── element-plus@2.3.12
├── nuxt@3.7.0
├── sass@1.66.1
└── typescript@5.2.2

system info

➜  element-plus-nuxt-starter git:(main) ✗ npx envinfo --system --npmPackages vue --binaries --browsers
Need to install the following packages:
  envinfo@7.10.0
Ok to proceed? (y) y

  System:
    OS: macOS 13.4.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 3.26 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
    pnpm: 8.6.3 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 116.0.5845.140
    Safari: 16.5.1
@YunYouJun
Copy link
Member

Try npm add pinia, pinia should be a child dependency of @pinia/nuxt.

@shroomlife
Copy link

When I do npm add pinia I get:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: element-plus-nuxt-starter@0.1.0
npm ERR! Found: vue@3.3.4
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.2.0" from @element-plus/icons-vue@2.1.0
npm ERR!   node_modules/@element-plus/icons-vue
npm ERR!     peer @element-plus/icons-vue@">=0.2.6" from @element-plus/nuxt@1.0.6
npm ERR!     node_modules/@element-plus/nuxt
npm ERR!       dev @element-plus/nuxt@"^1.0.5" from the root project
npm ERR!     @element-plus/icons-vue@"^2.0.6" from element-plus@2.3.14
npm ERR!     node_modules/element-plus
npm ERR!       peer element-plus@">=2" from @element-plus/nuxt@1.0.6
npm ERR!       node_modules/@element-plus/nuxt
npm ERR!         dev @element-plus/nuxt@"^1.0.5" from the root project
npm ERR!       1 more (the root project)
npm ERR!     1 more (the root project)
npm ERR!   peer vue@"^3.3.4" from @nuxt/vite-builder@3.7.3
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"3.7.3" from nuxt@3.7.3
npm ERR!     node_modules/nuxt
npm ERR!       nuxt@"^3.6.5" from @vueuse/nuxt@10.4.1
npm ERR!       node_modules/@vueuse/nuxt
npm ERR!         dev @vueuse/nuxt@"^10.2.0" from the root project
npm ERR!       1 more (the root project)
npm ERR!   15 more (pinia, vue-demi, @unhead/vue, @vitejs/plugin-vue, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 2.7" from @vue/composition-api@1.7.2
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from pinia@2.1.6
npm ERR!     node_modules/pinia
npm ERR!       pinia@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\robin\AppData\Local\npm-cache\_logs\2023-09-25T09_49_28_001Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\robin\AppData\Local\npm-cache\_logs\2023-09-25T09_49_28_001Z-debug-0.log

Just cloned the repo and it's not working. Someone needs to fix that.

genffy added a commit to genffy/element-plus-nuxt-starter that referenced this issue Sep 25, 2023
@genffy
Copy link
Contributor Author

genffy commented Sep 26, 2023

@shroomlife add legacy-peer-deps=true to .npmrc and then add pinia

@YunYouJun
Copy link
Member

I just upgrade new deps & lock. And it still works well. Try use lastest pnpm install it.

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

No branches or pull requests

3 participants