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

npx prisma studio throws spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT error on windows #767

Closed
fediev opened this issue Aug 27, 2021 · 10 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/developer-productivity Issue for team Developer Productivity. topic: windows

Comments

@fediev
Copy link

fediev commented Aug 27, 2021

  1. Prisma version (prisma -v or npx prisma -v):
  • first try: prisma@2.30
prisma                : 2.30.0
@prisma/client        : 2.30.0
Current platform      : windows
Query Engine (Binary) : query-engine 60b19f4a1de4fe95741da371b4c44a92f4d1adcb (at node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine      : migration-engine-cli 60b19f4a1de4fe95741da371b4c44a92f4d1adcb (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine  : introspection-core 60b19f4a1de4fe95741da371b4c44a92f4d1adcb (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary         : prisma-fmt 60b19f4a1de4fe95741da371b4c44a92f4d1adcb (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash  : 60b19f4a1de4fe95741da371b4c44a92f4d1adcb
Studio                : 0.422.0
  • second try: prisma@dev
prisma                  : 2.31.0-dev.19
@prisma/client          : 2.30.0
Current platform        : windows
Query Engine (Node-API) : libquery-engine c6aa2685dff09984e6656f5d99a90b9e90eabbce (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine        : migration-engine-cli c6aa2685dff09984e6656f5d99a90b9e90eabbce (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine    : introspection-core c6aa2685dff09984e6656f5d99a90b9e90eabbce (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary           : prisma-fmt c6aa2685dff09984e6656f5d99a90b9e90eabbce (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash    : c6aa2685dff09984e6656f5d99a90b9e90eabbce
Studio                  : 0.422.0
  1. Logs from Developer Tools Console or Command line, if any:
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
  1. Does the issue persist even after updating to the latest prisma alpha? (npm i -D @prisma/cli@dev): Yes.

I tested with prisma@2.29 and it worked well. Also, npx prisma studio --browser none works well.

It seems something wrong with launching browser in windows env.

@janpio
Copy link
Member

janpio commented Aug 27, 2021

Did I understand correctly that it works with Prisma 2.29 but not 2.30?

@fediev
Copy link
Author

fediev commented Aug 27, 2021

@janpio Yes, 2.29 works well.

  • prisma@2.29: OK
  • prisma@2.30: Error
  • prisma@2.31.0-dev.19: Error

Also, npx prisma studio --browser none on prisma.2.30 works expectedly.

@janpio
Copy link
Member

janpio commented Aug 27, 2021

I can confirm this regression:

C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npm install prisma@dev

> prisma@2.31.0-dev.19 preinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/preinstall-entry.js


> prisma@2.31.0-dev.19 install C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/install-entry.js


> @prisma/engines@2.31.0-11.c6aa2685dff09984e6656f5d99a90b9e90eabbce postinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\@prisma\engines
> node download/index.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN studio767@1.0.0 No description
npm WARN studio767@1.0.0 No repository field.

+ prisma@2.31.0-dev.19
added 2 packages from 1 contributor and audited 2 packages in 5.02s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npx prisma studio
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npm install prisma@latest

> prisma@2.30.0 preinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/preinstall-entry.js


> prisma@2.30.0 install C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/install-entry.js


> @prisma/engines@2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb postinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\@prisma\engines
> node download/index.js

npm WARN studio767@1.0.0 No description
npm WARN studio767@1.0.0 No repository field.

+ prisma@2.30.0
updated 2 packages and audited 2 packages in 4.315s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npx prisma studio
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npm install prisma@2.29

> prisma@2.29.1 preinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/preinstall-entry.js


> prisma@2.29.1 install C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/install-entry.js


> @prisma/engines@2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a postinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\@prisma\engines
> node download/index.js

npm WARN studio767@1.0.0 No description
npm WARN studio767@1.0.0 No repository field.

+ prisma@2.29.1
updated 2 packages and audited 2 packages in 3.549s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npx prisma studio
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Unable to get DMMF from Prisma Client:  Error:
You don't have any models defined in your schema.prisma, so nothing will be generated.
You can define a model like this:

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}

More information in our documentation:
https://pris.ly/d/prisma-schema

    at Object.getGenerators (C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma\build\index.js:35425:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async PCW.getDMMF (C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma\build\index.js:103357:36)
    at async PrismaService.respond (C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma\build\index.js:103716:50)
    at async C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma\build\index.js:103890:35

This shows the problem with prisma@dev and @latest, but it working with 2.29.1 (working = fails with error about missing model in schema - but it opened the browser window as it should)

Thanks for the report!

@janpio janpio added bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. topic: windows labels Aug 27, 2021
@janpio
Copy link
Member

janpio commented Aug 27, 2021

Quick research:
Prisma CLI uses open to open the browser windows. That contains this code: https://github.com/sindresorhus/open/blob/492445a7677a605448deb785360fd450829d8b7f/index.js#L132 ${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell
which seems to be executed with undefined as the value of SYSTEMROOT in 2.30 causing the problem you are seeing.

No idea why that env var is suddenly not available any more :( Someone from Prisma will look into this.

@janpio
Copy link
Member

janpio commented Aug 30, 2021

Some more research:

Last chagne to Studio via PR is prisma/prisma#8767
The merge commit is prisma/prisma@c7c3a9f
This is the dev release process: https://buildkite.com/prisma/prisma2-publish/builds/5199#c2e0149f-6e3f-4a82-a765-3ecfd4c7ab13
That says the commit was released as 2.30.0-dev.19

Meaning: 2.30.0-dev.19 is the first dev version that included the upgrade of studio-server

Broken:

C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npm install prisma@2.30.0-dev.19

> prisma@2.30.0-dev.19 preinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/preinstall-entry.js


> prisma@2.30.0-dev.19 install C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/install-entry.js


> @prisma/engines@2.30.0-10.0210b3de5042a714f8838a59f9edcb28b11ab97d postinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\@prisma\engines
> node download/index.js

npm WARN studio767@1.0.0 No description
npm WARN studio767@1.0.0 No repository field.

+ prisma@2.30.0-dev.19
updated 2 packages and audited 2 packages in 9.317s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npx prisma studio
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

Working:

C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npm install prisma@2.30.0-dev.18

> prisma@2.30.0-dev.18 preinstall C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/preinstall-entry.js


> prisma@2.30.0-dev.18 install C:\Users\Jan\Documents\throwaway\studio767\node_modules\prisma
> node scripts/install-entry.js

npm WARN studio767@1.0.0 No description
npm WARN studio767@1.0.0 No repository field.

+ prisma@2.30.0-dev.18
updated 1 package and audited 2 packages in 3.548s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\studio767  (studio767@1.0.0)
λ npx prisma studio
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
Unable to get DMMF from Prisma Client:  Error:
You don't have any models defined in your schema.prisma, so nothing will be generated.
You can define a model like this:

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}

More information in our documentation:
https://pris.ly/d/prisma-schema

dev.19 = failing
dev.18 = success

@Jolg42 Jolg42 added team/developer-productivity Issue for team Developer Productivity. process/candidate Candidate for next Milestone. labels Aug 31, 2021
@Jolg42 Jolg42 added this to the 2.31.0 / 3.0.x milestone Sep 2, 2021
@Jolg42 Jolg42 removed the process/candidate Candidate for next Milestone. label Sep 2, 2021
Jolg42 added a commit to prisma/prisma that referenced this issue Sep 2, 2021
@Jolg42
Copy link
Member

Jolg42 commented Sep 2, 2021

A fix was just released in Prisma CLI 2.30.3 patch.

Let us know if this indeed fixes it (or not) 😉

@Jolg42 Jolg42 closed this as completed Sep 2, 2021
@fediev
Copy link
Author

fediev commented Sep 3, 2021

It works well after updating to 2.30.3. Thanks.

@rRakarare
Copy link

I still have the problem with v. 2.31.0. Im using blitz.js by the way. prisma studio --browser none is working though.

@sdnts
Copy link
Contributor

sdnts commented Sep 29, 2021

Hey @rRakarare, Very weird.. If you could test it out with the latest Prisma (3.1.1) as well and let me know if you still see it, that'd be really appreciated!

@rRakarare
Copy link

Yep, with the latest version of Prisma (3.1.1) it's working properly. No errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/developer-productivity Issue for team Developer Productivity. topic: windows
Projects
None yet
Development

No branches or pull requests

5 participants