vbenjs / vue-vben-admin

A modern vue admin panel built with Vue3, Shadcn UI, Vite, TypeScript, and Monorepo. It's fast!
https://www.vben.pro
MIT License
25.58k stars 6.97k forks source link

pnpm install 以后 执行pnpm dev报错 #4098

Closed maxiong1 closed 3 months ago

maxiong1 commented 3 months ago

Version

Vben Admin V5

Describe the bug?

v5.0.0 v5.0.1 这两个版本执行pnpm dev、pnpm dev:antd、pnpm reinstall 都报错

vben-admin-pro@5.0.1 dev E:\vben3-admin\v5.0.1 turbo-run dev

node:internal/modules/esm/resolve:264 throw new ERR_MODULE_NOT_FOUND( ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\vben3-admin\v5.0.1\scripts\turbo-run\dist\index.mjs' imported from E:\vben3-admin\v5.0.1\scripts\turbo-run\bin\turbo-run.mjs at finalizeResolution (node:internal/modules/esm/resolve:264:11) at moduleResolve (node:internal/modules/esm/resolve:917:10) at defaultResolve (node:internal/modules/esm/resolve:1130:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38) at ModuleLoader.import (node:internal/modules/esm/loader:328:34) at importModuleDynamically (node:internal/modules/esm/translators:158:35) at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14) at file:///E:/vben3-admin/v5.0.1/scripts/turbo-run/bin/turbo-run.mjs:3:1 { code: 'ERR_MODULE_NOT_FOUND', url: 'file:///E:/vben3-admin/v5.0.1/scripts/turbo-run/dist/index.mjs' }

Node.js v20.11.1


+ pnpm dev:antd

``` bash
E:\vben3-admin\v5.0.1>pnpm dev:antd

> vben-admin-pro@5.0.1 dev:antd E:\vben3-admin\v5.0.1
> pnpm -F @vben/web-antd run dev

> @vben/web-antd@5.0.1 dev E:\vben3-admin\v5.0.1\apps\web-antd
> pnpm vite --mode development

X [ERROR] Failed to resolve entry for package "@vben/vite-config". The package may have incorrect main/module/exports specified in its package.json. [plugin externalize-deps]

    ../../node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1225:27:
      1225 │         let result = await callback({
           ╵                            ^

    at packageEntryFailure (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:46351:15)
    at resolvePackageEntry (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:46348:3)
    at tryNodeResolve (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:46164:16)
    at resolveByViteResolver (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:66259:20)
    at file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:66292:28
    at requestCallbacks.on-resolve (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:1225:28)
    at handleRequest (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:647:17)
    at handleIncomingPacket (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:672:7)
    at Socket.readFromStdout (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:600:7)
    at Socket.emit (node:events:518:28)

  This error came from the "onResolve" callback registered here:

    ../../node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1150:20:
      1150 │       let promise = setup({
           ╵                     ^

    at setup (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:66280:18)
    at handlePlugins (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:1150:21)
    at buildOrContextImpl (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:873:5)
    at Object.buildOrContext (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:699:5)
    at E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:2023:15
    at new Promise (<anonymous>)
    at Object.build (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:2022:25)
    at build (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:1873:51)
    at bundleConfigFile (file:///E:/vben3-admin/v5.0.1/node_modules/.pnpm/vite@5.3.5_@types+node@22.1.0_sass@1.77.8_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:66235:24)

  The plugin "externalize-deps" was triggered by this import

    vite.config.mts:1:355:
      1 │ ...ta_url = "file:///E:/vben3-admin/v5.0.1/apps/web-antd/vite.config.mts";import { defineConfig } from '@vben/vite-config';
        ╵                                                                                                                 ~~~~~~~~~~~~~~~~~~~

failed to load config from E:\vben3-admin\v5.0.1\apps\web-antd\vite.config.mts
error when starting dev server:
Error: Build failed with 1 error:
../../node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1225:27: ERROR: [plugin: externalize-deps] Failed to resolve entry for package "@vben/vite-config". The package may have incorrect main/module/exports specified in its package.json.
    at failureErrorWithLog (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:1472:15)
    at E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:945:25
    at runOnEndCallbacks (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:1315:45)
    at buildResponseToResult (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:943:7)
    at E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:970:16
    at responseCallbacks.<computed> (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:622:9)
    at handleIncomingPacket (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:677:12)
    at Socket.readFromStdout (E:\vben3-admin\v5.0.1\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\lib\main.js:600:7)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
E:\vben3-admin\v5.0.1\apps\web-antd:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @vben/web-antd@5.0.1 dev: `pnpm vite --mode development`
Exit status 1

vben-admin-pro@5.0.1 reinstall E:\vben3-admin\v5.0.1 pnpm clean --del-lock && pnpm bootstrap

vben-admin-pro@5.0.1 clean E:\vben3-admin\v5.0.1 vsh clean "--del-lock"

node:internal/modules/esm/resolve:264 throw new ERR_MODULE_NOT_FOUND( ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\vben3-admin\v5.0.1\scripts\vsh\dist\index.mjs' imported from E:\vben3-admin\v5.0.1\scripts\vsh\bin\vsh.mjs at finalizeResolution (node:internal/modules/esm/resolve:264:11) at moduleResolve (node:internal/modules/esm/resolve:917:10) at defaultResolve (node:internal/modules/esm/resolve:1130:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38) at ModuleLoader.import (node:internal/modules/esm/loader:328:34) at importModuleDynamically (node:internal/modules/esm/translators:158:35) at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14) at file:///E:/vben3-admin/v5.0.1/scripts/vsh/bin/vsh.mjs:3:1 { code: 'ERR_MODULE_NOT_FOUND', url: 'file:///E:/vben3-admin/v5.0.1/scripts/vsh/dist/index.mjs' }

Node.js v20.11.1


+ pnpm install log

``` bash
.../node_modules/vue-demi postinstall$ node -e "try{require('./scripts/postinstall.js')}catch(e){}"
.../node_modules/vue-demi postinstall: Done

devDependencies:
+ @changesets/changelog-github 0.5.0
+ @changesets/cli 2.27.7
+ @ls-lint/ls-lint 2.2.3
+ @types/jsdom 21.1.7
+ @types/node 22.2.0
+ @vben/commitlint-config 5.0.1 <- internal\lint-configs\commitlint-config
+ @vben/eslint-config 5.0.0 <- internal\lint-configs\eslint-config
+ @vben/prettier-config 5.0.0 <- internal\lint-configs\prettier-config
+ @vben/stylelint-config 5.0.1 <- internal\lint-configs\stylelint-config
+ @vben/tailwind-config 5.0.1 <- internal\tailwind-config
+ @vben/tsconfig 5.0.1 <- internal\tsconfig
+ @vben/turbo-run 5.0.1 <- scripts\turbo-run
+ @vben/vite-config 5.0.1 <- internal\vite-config
+ @vben/vsh 5.0.1 <- scripts\vsh
+ @vue/test-utils 2.4.6
+ autoprefixer 10.4.20
+ cross-env 7.0.3
+ cspell 8.13.2
+ husky 9.1.4
+ is-ci 3.0.1
+ jsdom 24.1.1
+ lint-staged 15.2.8
+ rimraf 6.0.1
+ tailwindcss 3.4.9
+ turbo 2.0.12
+ typescript 5.5.4
+ unbuild 2.0.0
+ vite 5.4.0
+ vitest 2.0.5
+ vue-tsc 2.0.29

. postinstall$ turbo run stub
. postinstall: Failed
 ELIFECYCLE  Command failed with exit code 3221225506.

Reproduction

https://github.com/vbenjs/vue-vben-admin (main分支)

System Info

window10、chrome
node v20.11.1
pnpm v9.7.0

Relevant log output

No response

Validations

wangjue666 commented 3 months ago

@maxiong1 直接执行 pnpm install 试试

vince292007 commented 3 months ago

pnpm install 没执行成功,可以检查 node 版本、pnpm版本是否与项目要求一致

anncwb commented 3 months ago

目前的错误上看,是pnpm install没执行成功,提供下 pnpm install 日志看看

maxiong1 commented 3 months ago

目前的错误上看,是pnpm install没执行成功,提供下 pnpm install 日志看看

这样可以吗

.../node_modules/vue-demi postinstall$ node -e "try{require('./scripts/postinstall.js')}catch(e){}"
.../node_modules/vue-demi postinstall: Done

devDependencies:
+ @changesets/changelog-github 0.5.0
+ @changesets/cli 2.27.7
+ @ls-lint/ls-lint 2.2.3
+ @types/jsdom 21.1.7
+ @types/node 22.2.0
+ @vben/commitlint-config 5.0.1 <- internal\lint-configs\commitlint-config
+ @vben/eslint-config 5.0.0 <- internal\lint-configs\eslint-config
+ @vben/prettier-config 5.0.0 <- internal\lint-configs\prettier-config
+ @vben/stylelint-config 5.0.1 <- internal\lint-configs\stylelint-config
+ @vben/tailwind-config 5.0.1 <- internal\tailwind-config
+ @vben/tsconfig 5.0.1 <- internal\tsconfig
+ @vben/turbo-run 5.0.1 <- scripts\turbo-run
+ @vben/vite-config 5.0.1 <- internal\vite-config
+ @vben/vsh 5.0.1 <- scripts\vsh
+ @vue/test-utils 2.4.6
+ autoprefixer 10.4.20
+ cross-env 7.0.3
+ cspell 8.13.2
+ husky 9.1.4
+ is-ci 3.0.1
+ jsdom 24.1.1
+ lint-staged 15.2.8
+ rimraf 6.0.1
+ tailwindcss 3.4.9
+ turbo 2.0.12
+ typescript 5.5.4
+ unbuild 2.0.0
+ vite 5.4.0
+ vitest 2.0.5
+ vue-tsc 2.0.29

. postinstall$ turbo run stub
. postinstall: Failed
 ELIFECYCLE  Command failed with exit code 3221225506.
wangjue666 commented 3 months ago

@maxiong1 可以 这时候你再执行 pnpm dev 试试

maxiong1 commented 3 months ago

@maxiong1 可以 这时候你再执行 pnpm dev 试试

试了,还是出现

> turbo-run dev

node:internal/modules/esm/resolve:264
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\vue-vben-admin-main\scripts\turbo-run\dist\index.mjs' imported from E:\vue-vben-admin-main\scripts\turbo-run\bin\turbo-run.mjs
    at finalizeResolution (node:internal/modules/esm/resolve:264:11)
    at moduleResolve (node:internal/modules/esm/resolve:917:10)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:328:34)
    at importModuleDynamically (node:internal/modules/esm/translators:158:35)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14)
    at file:///E:/vue-vben-admin-main/scripts/turbo-run/bin/turbo-run.mjs:3:1 {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///E:/vue-vben-admin-main/scripts/turbo-run/dist/index.mjs'
}

看后面 执行 postinstall:turbo run stub postinstall:Failed,是不是还有部分依赖没安装成功? turbo我也全局安装了

wangjue666 commented 3 months ago

postinstall: Failed 没有执行成功, 你试试再次 pnpm install

anncwb commented 3 months ago

你用的shell工具是 powershell吗,不是的话换这个试试

baiyang9-tal commented 3 months ago

一跑起来就是奇奇怪怪的错啊 Yach_screenshot_20240813201523

anncwb commented 3 months ago

一跑起来就是奇奇怪怪的错啊 Yach_screenshot_20240813201523

这个看起来是你本地host文件配置问题

wangjue666 commented 3 months ago

一跑起来就是奇奇怪怪的错啊 Yach_screenshot_20240813201523

代理关了试试

yangtianfu01 commented 3 months ago

nodejs的版本, 安装node20.16.0, 不要装22+的版本, pnpm会报错的

Luo-RongLi commented 3 months ago

我也遇到这个问题,找了一天资料了,都没解决微信截图_20240816180222 w