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

[bug]: pnpm install failed with Module '"@prisma/client"' has no exported member XXX #3373

Open
1 task done
liudonghua123 opened this issue Sep 19, 2023 · 11 comments
Open
1 task done
Labels
bug Something isn't working need testing Needs to be tested before merging onto production self-host Self hosted Hoppscotch instance

Comments

@liudonghua123
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I tried to execute pnpm install on windows. But some errors occured!

D:\code\rust\hoppscotch-app\hoppscotch>pnpm install
Scope: all 11 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl
│ > @hoppscotch/data@0.4.4 build:code D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
│ > vite build
│ vite v3.2.4 building for production...
│ transforming...
│ ✓ 287 modules transformed.
│ rendering chunks...
│ dist/hoppscotch-data.js   46.28 KiB / gzip: 13.39 KiB
│ dist/hoppscotch-data.cjs   34.28 KiB / gzip: 12.04 KiB
│ > @hoppscotch/data@0.4.4 build:decl D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
│ > tsc --project tsconfig.decl.json
└─ Done in 19s
packages/codemirror-lang-graphql prepare$ rollup -c
│ Browserslist: caniuse-lite is outdated. Please run:
│   npx browserslist@latest --update-db
│   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
│
│ src/index.js → dist/index.cjs, ./dist...
│ created dist/index.cjs, ./dist in 4.8s
└─ Done in 19.4s
packages/dioc prepare$ pnpm run build
[5 lines collapsed]
│ rendering chunks...
│ computing gzip size...
│ dist/vue.js                  0.33 kB │ gzip: 0.24 kB
│ dist/testing.js              0.52 kB │ gzip: 0.33 kB
│ dist/index.js                1.80 kB │ gzip: 0.77 kB
│ dist/container-9dabdb69.js  16.60 kB │ gzip: 4.60 kB
│ dist/vue.cjs                  0.34 kB │ gzip: 0.26 kB
│ dist/testing.cjs              0.43 kB │ gzip: 0.32 kB
│ dist/index.cjs                1.25 kB │ gzip: 0.62 kB
│ dist/container-1fe4cc86.cjs  11.09 kB │ gzip: 3.64 kB
└─ Done in 19.4s
packages/hoppscotch-ui postinstall$ pnpm run build
[1 lines collapsed]
│ > vite build
│ vite v3.2.4 building for production...
│ transforming...
│ ✓ 741 modules transformed.
│ rendering chunks...
│ [vite:dts] Start generate declaration files...
│ dist/style.css     66.24 KiB / gzip: 7.96 KiB
│ dist/index.es.js   221.19 KiB / gzip: 48.94 KiB
│ dist/index.es.js.map 831.71 KiB
│ [vite:dts] Declaration files built in 14099ms.
└─ Done in 1m 1.5s
packages/hoppscotch-backend postinstall$ prisma generate && pnpm run generate-gql-sdl
│ Prisma schema loaded from prisma\schema.prisma
│ ✔ Generated Prisma Client (4.16.2 | library) to .\..\..\node_modules\.pnpm\@prisma+client@4.16.2_prisma@4.16.2\node…
│ You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
│ ```
│ import { PrismaClient } from '@prisma/client'
│ const prisma = new PrismaClient()
│ ```
│ > hoppscotch-backend@2023.8.1 generate-gql-sdl D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-backend
│ > cross-env GQL_SCHEMA_EMIT_LOCATION='../../../gql-gen/backend-schema.gql' GENERATE_GQL_SCHEMA=true WHITELISTED_ORI…
│ src/auth/auth.service.ts:29:10 - error TS2305: Module '"@prisma/client"' has no exported member 'VerificationToken'.
│ 29 import { VerificationToken } from '@prisma/client';
│             ~~~~~~~~~~~~~~~~~
│ src/pubsub/topicsDefs.ts:24:10 - error TS2305: Module '"@prisma/client"' has no exported member 'UserCollection'.
│ 24 import { UserCollection } from '@prisma/client';
│             ~~~~~~~~~~~~~~
│ src/shortcode/shortcode.service.ts:10:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Shortcod…
│ 10 import { Shortcode as DBShortCode } from '@prisma/client';
│             ~~~~~~~~~
│ src/team-collection/team-collection.service.ts:21:18 - error TS2305: Module '"@prisma/client"' has no exported memb…
│ 21 import { Prisma, TeamCollection as DBTeamCollection } from '@prisma/client';
│                     ~~~~~~~~~~~~~~
│ src/team-collection/team-collection.service.ts:46:13 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hoppsc…
│ 46   ): Prisma.TeamCollectionCreateInput {
│                ~~~~~~~~~~~~~~~~~~~~~~~~~
│ src/team-collection/team-collection.service.ts:554:33 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hopps…
│ 554     orderIndexCondition: Prisma.IntFilter,
│                                     ~~~~~~~~~
│ src/team-collection/team-collection.service.ts:555:27 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hopps…
│ 555     dataCondition: Prisma.IntFieldUpdateOperationsInput,
│                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ src/team-environments/gql-team-env-team.guard.ts:14:10 - error TS2305: Module '"@prisma/client"' has no exported me…
│ 14 import { TeamMemberRole } from '@prisma/client';
│             ~~~~~~~~~~~~~~
│ src/team-environments/team-environments.service.ts:2:10 - error TS2305: Module '"@prisma/client"' has no exported m…
│ 2 import { TeamEnvironment as DBTeamEnvironment, Prisma } from '@prisma/client';
│            ~~~~~~~~~~~~~~~
│ src/team-environments/team-environments.service.ts:197:54 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/h…
│ 197           variables: environment.variables as Prisma.JsonArray,
│                                                          ~~~~~~~~~
│ src/team-invitation/team-invitation.service.ts:5:10 - error TS2305: Module '"@prisma/client"' has no exported membe…
│ 5 import { TeamInvitation as DBTeamInvitation } from '@prisma/client';
│            ~~~~~~~~~~~~~~
│ src/team-request/team-request.resolver.ts:222:41 - error TS2345: Argument of type 'unknown' is not assignable to pa…
│ 222     if (E.isLeft(teamRequest)) throwErr(teamRequest.left);
│                                             ~~~~~~~~~~~~~~~~
│ src/team-request/team-request.resolver.ts:239:41 - error TS2345: Argument of type 'unknown' is not assignable to pa…
│ 239     if (E.isLeft(teamRequest)) throwErr(teamRequest.left);
│                                             ~~~~~~~~~~~~~~~~
│ src/team-request/team-request.service.ts:17:18 - error TS2305: Module '"@prisma/client"' has no exported member 'Te…
│ 17 import { Prisma, TeamRequest as DbTeamRequest } from '@prisma/client';
│                     ~~~~~~~~~~~
│ src/team-request/team-request.service.ts:50:33 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hoppscotch/n…
│ 50       const updateInput: Prisma.TeamRequestUpdateInput = { title };
│                                    ~~~~~~~~~~~~~~~~~~~~~~
│ src/team-request/team-request.service.ts:150:31 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hoppscotch/…
│ 150     const createInput: Prisma.TeamRequestCreateInput = {
│                                   ~~~~~~~~~~~~~~~~~~~~~~
│ src/team-request/team-request.service.ts:361:20 - error TS2347: Untyped function calls may not accept type argument…
│ 361       return await this.prisma.$transaction<
│                        ~~~~~~~~~~~~~~~~~~~~~~~~~
│ 362         E.Left<string> | E.Right<DbTeamRequest>
│     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ ...
│ 421         return E.right(updatedRequest);
│     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ 422       });
│     ~~~~~~~~
│ src/team/decorators/requires-team-role.decorator.ts:1:10 - error TS2305: Module '"@prisma/client"' has no exported …
│ 1 import { TeamMemberRole } from '@prisma/client';
│            ~~~~~~~~~~~~~~
│ src/team/team.service.ts:4:10 - error TS2305: Module '"@prisma/client"' has no exported member 'TeamMember'.
│ 4 import { TeamMember as DbTeamMember } from '@prisma/client';
│            ~~~~~~~~~~
│ src/team/team.service.ts:424:53 - error TS2339: Property 'teamID' does not exist on type 'unknown'.
│ 424             const res = await this.leaveTeam(member.teamID, uid);
│                                                         ~~~~~~
│ src/types/AuthUser.ts:1:10 - error TS2305: Module '"@prisma/client"' has no exported member 'User'.
│ 1 import { User } from '@prisma/client';
│            ~~~~
│ src/user-collection/user-collection.service.ts:21:18 - error TS2305: Module '"@prisma/client"' has no exported memb…
│ 21 import { Prisma, UserCollection, ReqType as DBReqType } from '@prisma/client';
│                     ~~~~~~~~~~~~~~
│ src/user-collection/user-collection.service.ts:21:34 - error TS2305: Module '"@prisma/client"' has no exported memb…
│ 21 import { Prisma, UserCollection, ReqType as DBReqType } from '@prisma/client';
│                                     ~~~~~~~
│ src/user-collection/user-collection.service.ts:540:33 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hopps…
│ 540     orderIndexCondition: Prisma.IntFilter,
│                                     ~~~~~~~~~
│ src/user-collection/user-collection.service.ts:541:27 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hopps…
│ 541     dataCondition: Prisma.IntFieldUpdateOperationsInput,
│                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ src/user-collection/user-collection.service.ts:946:13 - error TS2694: Namespace '"D:/code/rust/hoppscotch-app/hopps…
│ 946   ): Prisma.UserCollectionCreateInput {
│                 ~~~~~~~~~~~~~~~~~~~~~~~~~
│ src/user-request/user-request.service.ts:6:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Use…
│ 6 import { UserRequest as DbUserRequest } from '@prisma/client';
│            ~~~~~~~~~~~
│ src/user-request/user-request.service.ts:386:20 - error TS2347: Untyped function calls may not accept type argument…
│ 386       return await this.prisma.$transaction<
│                        ~~~~~~~~~~~~~~~~~~~~~~~~~
│ 387         E.Left<string> | E.Right<DbUserRequest>
│     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ ...
│ 446         return E.right(updatedRequest);
│     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ 447       });
│     ~~~~~~~~
│ src/user-settings/user-settings.service.ts:7:10 - error TS2305: Module '"@prisma/client"' has no exported member 'U…
│ 7 import { UserSettings as DbUserSettings } from '@prisma/client';
│            ~~~~~~~~~~~~
│ src/user/user.service.ts:17:10 - error TS2305: Module '"@prisma/client"' has no exported member 'User'.
│ 17 import { User as DbUser } from '@prisma/client';
│             ~~~~
│ Found 30 error(s).
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 4m 19.8s at D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-backend
. prepare$ husky install
│ husky - Git hooks installed
└─ Done in 418ms
 ELIFECYCLE  Command failed with exit code 1.

D:\code\rust\hoppscotch-app\hoppscotch>

Steps to reproduce

  1. git clone https://github.com/hoppscotch/hoppscotch.git
  2. cd hoppscotch
  3. cp .env.example .env
  4. pnpm install

Environment

Production

Version

Local

@liudonghua123 liudonghua123 added bug Something isn't working need testing Needs to be tested before merging onto production labels Sep 19, 2023
@liudonghua123
Copy link
Author

I also tried remove packages\hoppscotch-backend\dist and node_modules, but it's the same.

@balub
Copy link
Member

balub commented Sep 21, 2023

@liudonghua123 this is a known issue with Windows platform, we currently have a temporary fix. Could you replace the import import { User } from '@prisma/client'; to import type { User } from '@prisma/client'; in the AuthUser.ts file in the hoppscotch-backend package.

@liudonghua123
Copy link
Author

liudonghua123 commented Sep 21, 2023

@liudonghua123 this is a known issue with Windows platform, we currently have a temporary fix. Could you replace the import import { User } from '@prisma/client'; to import type { User } from '@prisma/client'; in the AuthUser.ts file in the hoppscotch-backend package.

@balub Thanks, is it a common or general issue related to typescript or just prisma? Is there any existed issue about this problem?

The temporary fix needs to change a lot of code.

I tried to replace the import import { User } from '@prisma/client'; to import type { User } from '@prisma/client';, but the same errors still shown.

image

@liudonghua123
Copy link
Author

After some search, I found some help links, prisma/prisma#13672 (comment), prisma/prisma#13946 (comment), https://github.com/orgs/pnpm/discussions/4331, https://pnpm.io/next/npmrc#node-linker, https://nodejs.org/api/cli.html#node_preserve_symlinks1.

So maybe pnpm in monorepo project on windows with some default configuration like preserveSymlinks : true is problematic.

Need to disable preserveSymlinks and hoist prisma.

@liudonghua123
Copy link
Author

I tried run pnpm with --preserve-symlinks, but I got some other errors.

Details ``` D:\code\rust\hoppscotch-app\hoppscotch>set NODE_OPTIONS="--preserve-symlinks"

D:\code\rust\hoppscotch-app\hoppscotch>rm -rf node_modules\ && pnpm install
Scope: all 11 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +2591
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 2591, reused 2536, downloaded 0, added 2299, done

dependencies:

  • husky 7.0.4
  • lint-staged 12.5.0

devDependencies:

  • @commitlint/cli 16.3.0
  • @commitlint/config-conventional 16.2.4
  • @types/node 17.0.45
  • cross-env 7.0.3
  • http-server 14.1.1

packages/dioc prepare$ pnpm run build
│ > dioc@0.1.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\dioc
│ > vite build && tsc --emitDeclarationOnly
└─ Running...
packages/codemirror-lang-graphql prepare$ rollup -c
└─ Running...
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl
│ > @hoppscotch/data@0.4.4 build:code D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
│ > vite build
│ ✘ [ERROR] Cannot start service: Host version "0.15.15" does not match binary version "0.14.48"
│ 1 error
[1 lines collapsed]
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│3 at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
│ 1 error
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data\vite.config.ts
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ vite v4.0.4 building for production...\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
└─ Running...
packages/codemirror-lang-graphql prepare$ rollup -ch-app\hoppscotch\packages\hoppscotch-ui\vite.config.ts
└─ Running...
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
[4 lines collapsed]
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data\vite.config.ts_@types+node@17.0.…
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
│ at Socket.emit (node:events:523:35)
│ at endReadableNT (node:internal/streams/readable:1367:12)
│ at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│  ELIFECYCLE  Command failed with exit code 1.
└─ Running...
│ transforming...ch-ui postinstall$ pnpm run build
└─ Running...
packages/codemirror-lang-graphql prepare$ rollup -ch-app\hoppscotch\packages\hoppscotch-ui\vite.config.ts
└─ Running...
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl
[4 lines collapsed]
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data\vite.config.ts_@types+node@17.0.…
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
│ at Socket.emit (node:events:523:35)
│ at endReadableNT (node:internal/streams/readable:1367:12)
│ at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│  ELIFECYCLE  Command failed with exit code 1.
└─ Running...
│ > @hoppscotch/data@0.4.4 build:code D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
│ > vite build
│ ✘ [ERROR] Cannot start service: Host version "0.15.15" does not match binary version "0.14.48"config.ts
│ 1 error
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data\vite.config.ts
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
│ at Socket.emit (node:events:523:35)
│ at endReadableNT (node:internal/streams/readable:1367:12)
│ at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│  ELIFECYCLE  Command failed with exit code 1. generate && pnpm run generate-gql-sdl
└─ Failed in 9.8s at D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
packages/hoppscotch-ui postinstall$ pnpm run build
│ > @hoppscotch/ui@0.0.1 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui
│ > vite build
│ ✘ [ERROR] Cannot start service: Host version "0.15.15" does not match binary version "0.14.48"
│ 1 error
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui\vite.config.ts
│ error during build:
│ Error: The service was stopped
│ at D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\n…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ at responseCallbacks. (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.…
│ at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.5…
│ at Socket.emit (node:events:523:35)
│ at endReadableNT (node:internal/streams/readable:1367:12)
│ at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 9.8s at D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui
packages/hoppscotch-backend postinstall$ prisma generate && pnpm run generate-gql-sdl
└─ Running...
 ELIFECYCLE  Command failed with exit code 1.
. prepare$ husky install
└─ Running...

D:\code\rust\hoppscotch-app\hoppscotch>

</details> 

@liudonghua123
Copy link
Author

I tried the following hacks to fix Cannot start service: Host version "0.15.15" does not match binary version "0.14.48". But when I execute pnpm install, the links was reset and the same errors occured.

cd node_modules\.pnpm\node_modules
# esbuild-windows-64 was Junction linked to D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\esbuild-windows-64@0.14.48\node_modules\esbuild-windows-64
rm esbuild-windows-64
mklink /J esbuild-windows-64 D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\esbuild-windows-64@0.15.15\node_modules\esbuild-windows-64
D:\code\rust\hoppscotch-app\hoppscotch>node_modules\.pnpm\node_modules\esbuild-windows-64\esbuild.exe --version
0.15.15

D:\code\rust\hoppscotch-app\hoppscotch>
D:\code\rust\hoppscotch-app\hoppscotch>pnpm install
Scope: all 11 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
packages/codemirror-lang-graphql prepare$ rollup -c
└─ Running...
packages/dioc prepare$ pnpm run build
│ > dioc@0.1.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\dioc
│ > vite build && tsc --emitDeclarationOnly
└─ Running...                                                                                                                                                        
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl
│ > @hoppscotch/data@0.4.4 build:code D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data                                                                
│ > vite build
│ ✘ [ERROR] Cannot start service: Host version "0.15.15" does not match binary version "0.14.48"
│ 1 error
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data\vite.config.ts
│ error during build:
│ Error: The service was stopped
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\node_modules\esbuild\lib\main.js:1113:…
│     at responseCallbacks.<computed> (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\node_mod…  
│     at Socket.afterClose (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\vite@3.2.4_@types+node@17.0.45_sass@1.53.0_terser@5.19.2\node_modules\esbuil…  
│     at Socket.emit (node:events:523:35)
│     at endReadableNT (node:internal/streams/readable:1367:12)                                                                                                      
│     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)                                                                                 
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 6.5s at D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data                                                                                 
packages/hoppscotch-ui postinstall$ pnpm run build                                                                                                                   
│ > @hoppscotch/ui@0.0.1 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui
│ > vite build
└─ Running...
packages/hoppscotch-backend postinstall$ prisma generate && pnpm run generate-gql-sdl
└─ Running...
 ELIFECYCLE  Command failed with exit code 1.

D:\code\rust\hoppscotch-app\hoppscotch>node_modules\.pnpm\node_modules\esbuild-windows-64\esbuild.exe --version
0.14.48

D:\code\rust\hoppscotch-app\hoppscotch>

@liudonghua123
Copy link
Author

After I add "esbuild": "0.15.15" to package.json of root dir, I got TypeError: Class extends value undefined is not a constructor or null.

D:\code\rust\hoppscotch-app\hoppscotch>pnpm install
Scope: all 11 workspace projects
packages/hoppscotch-cli                  |  WARN  deprecated @types/chalk@2.2.0
packages/hoppscotch-cli                  |  WARN  deprecated @types/commander@2.12.2
packages/hoppscotch-cli                  |  WARN  deprecated @types/axios@0.14.0
packages/hoppscotch-backend              |  WARN  deprecated @types/argon2@0.15.0
packages/hoppscotch-backend              |  WARN  deprecated apollo-server-express@3.11.1
packages/hoppscotch-backend              |  WARN  deprecated apollo-server-plugin-base@3.7.1
packages/hoppscotch-common               |  WARN  deprecated @intlify/vite-plugin-vue-i18n@7.0.0
packages/hoppscotch-common               |  WARN  deprecated subscriptions-transport-ws@0.11.0
packages/hoppscotch-common               |  WARN  deprecated insomnia-importers@3.6.0
packages/hoppscotch-selfhost-web         |  WARN  deprecated vite-plugin-fonts@0.6.0
 WARN  18 deprecated subdependencies found: @volar/html2pug@0.27.13, apollo-datasource@3.3.2, apollo-reporting-protobuf@3.3.3, apollo-server-core@3.11.1, apollo-server-env@4.2.1, apollo-server-errors@3.3.1, apollo-server-types@3.7.1, json-schema-ref-parser@7.1.4, preview-email@3.0.5, rollup-plugin-inject@3.0.2, rollup-plugin-terser@7.0.2, sourcemap-codec@1.4.8, swagger-methods@2.0.2, vscode-pug-languageservice@0.27.24, vscode-typescript-languageservice@0.27.25, vscode-vue-languageservice@0.27.30, workbox-cacheable-response@6.6.0, xmldom@0.1.31
Packages: +16 -14
++++++++++++++++--------------
Progress: resolved 2629, reused 2534, downloaded 0, added 0, done
packages/hoppscotch-data prepare$ pnpm run build:code && pnpm run build:decl
│ > @hoppscotch/data@0.4.4 build:code D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
│ > vite build
│ vite v3.2.4 building for production...                                                                                                        
│ transforming...
│ ✓ 287 modules transformed.
│ rendering chunks...
│ dist/hoppscotch-data.js   46.28 KiB / gzip: 13.39 KiB
└─ Running...                                                                                                                                   
packages/codemirror-lang-graphql prepare$ rollup -c
│ dist/hoppscotch-data.cjs   34.28 KiB / gzip: 12.04 KiB                                                                                        
└─ Running...
packages/codemirror-lang-graphql prepare$ rollup -c                                                                                             
│ > @hoppscotch/data@0.4.4 build:decl D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-data
└─ Running...
packages/codemirror-lang-graphql prepare$ rollup -c
│ > tsc --project tsconfig.decl.json
└─ Running...                                                                                                                                   
packages/codemirror-lang-graphql prepare$ rollup -c
└─ Running...                                                                                                                                   
packages/dioc prepare$ pnpm run build
[5 lines collapsed]                                                                                                                             
│ rendering chunks...                                                                                                                           
│ computing gzip size...                                                                                                                        
│ dist/vue.js                  0.33 kB │ gzip: 0.24 kB
│ dist/testing.js              0.52 kB │ gzip: 0.33 kBB                                                                                         
│ dist/index.js                1.80 kB │ gzip: 0.77 kBB
│ dist/container-9dabdb69.js  16.60 kB │ gzip: 4.60 kB                                                                                          
│ dist/vue.cjs                  0.34 kB │ gzip: 0.26 kB
│ dist/testing.cjs              0.43 kB │ gzip: 0.32 kB
│ dist/index.cjs                1.25 kB │ gzip: 0.62 kBe && pnpm run generate-gql-sdlotch-ui
│ dist/container-1fe4cc86.cjs  11.09 kB │ gzip: 3.64 kB
└─ Running...                                                                                                                                   
packages/hoppscotch-backend postinstall$ prisma generate && pnpm run generate-gql-sdlotch-ui
└─ Running...                                                                                                                                   
packages/hoppscotch-ui postinstall$ pnpm run build                                                                                              
│ > @hoppscotch/ui@0.0.1 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui                                                    
│ > vite build
│ failed to load config from D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui\vite.config.ts
│ error during build:
│ TypeError: Class extends value undefined is not a constructor or null
│     at Object.<anonymous> (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\node_modules\@volar\language-core\out\sourceMaps.js:5:…  
│     at Module._compile (node:internal/modules/cjs/loader:1255:14)
│     at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
│     at Module.load (node:internal/modules/cjs/loader:1113:32)
│     at Module._load (node:internal/modules/cjs/loader:960:12)
│     at Module.require (node:internal/modules/cjs/loader:1137:19)
│     at require (node:internal/modules/helpers:121:18)
│     at Object.<anonymous> (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\node_modules\@volar\language-core\out\virtualFiles.js:…
│     at Module._compile (node:internal/modules/cjs/loader:1255:14)
│     at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 11.6s at D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-ui
 ELIFECYCLE  Command failed with exit code 1.
. prepare$ husky install
└─ Running...

D:\code\rust\hoppscotch-app\hoppscotch>

It seems it related to vitejs/vite#9703, vu3th/vue-dapp#20 (comment). And I added the following commonjsOptions configuration in vite.config.ts of packages/hoppscotch-ui, packages/hoppscotch-data. But the errors still shown.

export default defineConfig({
  build: {
    ...
    commonjsOptions: {
      transformMixedEsModules: true,
    },
  },
})

@cherking
Copy link

same problem.have you solved it

@fdj0429
Copy link

fdj0429 commented Feb 28, 2024

First cd packages/hoppscotch-backend and do a rm -rf dist && pnpm prisma generate && pnpm install, then go to top level folder and re-run pnpm install works for me

@sgch1982
Copy link

same problem in windows

@cherking
Copy link

cherking commented May 7, 2024

First cd packages/hoppscotch-backend and do a rm -rf dist && pnpm prisma generate && pnpm install, then go to top level folder and re-run pnpm install works for me

dosen't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need testing Needs to be tested before merging onto production self-host Self hosted Hoppscotch instance
Projects
None yet
Development

No branches or pull requests

6 participants