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

generate does not work in folders with spaces #1973

Closed
janpio opened this issue Mar 27, 2020 · 10 comments
Closed

generate does not work in folders with spaces #1973

janpio opened this issue Mar 27, 2020 · 10 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/typescript Issue for tech TypeScript. topic: prisma generate CLI: prisma generate topic: windows
Milestone

Comments

@janpio
Copy link
Member

janpio commented Mar 27, 2020

C:\Users\Jan\Downloads\prisma chinook master cli-demo>npx prisma2 generate
'C:\Users\Jan\Downloads\prisma' is not recognized as an internal or external command,
operable program or batch file.
Error: Cannot call write after a stream was destroyed

with DEBUG=* set:

C:\Users\Jan\Downloads\prisma chinook master cli-demo>set DEBUG=*

C:\Users\Jan\Downloads\prisma chinook master cli-demo>npx prisma2 generate
  prisma .env loaded from ./prisma/.env +0ms
  getos { platform: 'win32', libssl: undefined } +0ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe. Result:  {
  command: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\cli\\query-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'prisma d35b3d764e66598164f3b8ce821d452b09d4a613',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +0ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe. Result:  prisma d35b3d764e66598164f3b8ce821d452b09d4a613 +3ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +1ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\migration-engine-windows.exe. Result:  {
  command: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\cli\\migration-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'migration-engine-cli d35b3d764e66598164f3b8ce821d452b09d4a613',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +8ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\migration-engine-windows.exe. Result:  migration-engine-cli d35b3d764e66598164f3b8ce821d452b09d4a613 +15ms
  download { works: true } +2ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\introspection-engine-windows.exe. Result:  {
  command: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\cli\\introspection-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'introspection-core d35b3d764e66598164f3b8ce821d452b09d4a613',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +2ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\introspection-engine-windows.exe. Result:  introspection-core d35b3d764e66598164f3b8ce821d452b09d4a613 +2ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  getos { platform: 'win32', libssl: undefined } +128ms
  getos { platform: 'win32', libssl: undefined } +19ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe. Result:  {
  command: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\cli\\query-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'prisma d35b3d764e66598164f3b8ce821d452b09d4a613',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +75ms
  download Getting version of C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe. Result:  prisma d35b3d764e66598164f3b8ce821d452b09d4a613 +5ms
  download { works: true } +1ms
  download { needsToBeDownloaded: false } +0ms
  getGenerators {
  getGenerators   binaryPathsWithEngineType: {
  getGenerators     'query-engine': {
  getGenerators       windows: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\cli\\query-engine-windows.exe'
  getGenerators     }
  getGenerators   }
  getGenerators } +0ms
  engineCommands getDMMF, override prismaPath = C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe +0ms
  engineCommands getConfig, override prismaPath = C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe +97ms
  getos { platform: 'win32', libssl: undefined } +242ms
{
  prismaClientDir: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\client'
}
  getGenerators {
  getGenerators   outputPath: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\client',
  getGenerators   generatorPath: 'C:\\Users\\Jan\\Downloads\\prisma chinook master cli-demo\\node_modules\\@prisma\\client\\generator-build\\index.js'
  getGenerators } +218ms
'C:\Users\Jan\Downloads\prisma' is not recognized as an internal or external command,
operable program or batch file.
  Generator:C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\client\generator-build\index.js Sending "getManifest" rpc to generator +0ms
Error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:413:19)
    at writeOrBuffer (_stream_writable.js:401:5)
    at Socket.Writable.write (_stream_writable.js:301:11)
    at GeneratorProcess.sendMessage (C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\build\index.js:2:549432)
    at C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\build\index.js:2:549706
    at new Promise (<anonymous>)
    at GeneratorProcess.getManifest (C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\build\index.js:2:549558)
    at Generator.<anonymous> (C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\build\index.js:2:745695)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\build\index.js:2:744975)

After renaming the folder to not contain spaces, everything works:

C:\Users\Jan\Downloads\prismachinookmastercli-demo>npx prisma2 generate
✔ Generated Prisma Client to .\node_modules\@prisma\client in 248ms

You can now start using Prisma Client in your code:

`
import { PrismaClient } from '@prisma/client'
// or const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()
`

Explore the full API: http://pris.ly/d/client


C:\Users\Jan\Downloads\prismachinookmastercli-demo>

version:

C:\Users\Jan\Downloads\prisma chinook master cli-demo>npx prisma2 --version
@prisma/cli          : 2.0.0-alpha.978
Current platform     : windows
Query Engine         : prisma d35b3d764e66598164f3b8ce821d452b09d4a613 (at C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\query-engine-windows.exe)
Migration Engine     : migration-engine-cli d35b3d764e66598164f3b8ce821d452b09d4a613 (at C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\migration-engine-windows.exe)
Introspection Engine : introspection-core d35b3d764e66598164f3b8ce821d452b09d4a613 (at C:\Users\Jan\Downloads\prisma chinook master cli-demo\node_modules\@prisma\cli\introspection-engine-windows.exe)
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels Mar 30, 2020
@pantharshit00
Copy link
Contributor

I can confirm this on my windows machine as well.

@janpio janpio added this to the Foo Backlog milestone Mar 30, 2020
@pramodsvidyarthi
Copy link

This issues holds true for a mac as well.

@ivankhm
Copy link

ivankhm commented Apr 4, 2020

Confirming, on Mac OS 10.14.1 with Prisma 2 beta 1
Here is my package.json

{
  "name": "api-server-experemental",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@prisma/cli": "^2.0.0-beta.1",
    "@types/node": "^13.11.0",
    "ts-node": "^8.8.1",
    "typescript": "^3.8.3"
  },
  "dependencies": {
    "@prisma/client": "^2.0.0-beta.1"
  }
}

I store my projects in folder "VSCode Projects", and just by following quickstart tutorial got same error, here is debug log:

MacBook-Pro-Evan:api-server-experemental Evan$  DEBUG="*" npx prisma generate
  prisma .env loaded from ./prisma/.env +0ms
(node:4610) ExperimentalWarning: The fs.promises API is experimental
  getos { platform: 'darwin', libssl: undefined } +0ms
  download { cachedFile:
  download    '/Users/Evan/.cache/prisma/master/2accb9c7eacdc984874eaeb63377fe705dfd3203/darwin/query-engine' } +0ms
  download { cachedFile:
  download    '/Users/Evan/.cache/prisma/master/2accb9c7eacdc984874eaeb63377fe705dfd3203/darwin/migration-engine' } +2ms
  download { cachedFile:
  download    '/Users/Evan/.cache/prisma/master/2accb9c7eacdc984874eaeb63377fe705dfd3203/darwin/introspection-engine' } +1ms
  getos { platform: 'darwin', libssl: undefined } +9ms
  getos { platform: 'darwin', libssl: undefined } +0ms
  download { cachedFileSize: 16570608, targetFileSize: 16570608 } +1ms
  download { cachedFileSize: 14816616, targetFileSize: 14816616 } +46ms
  download { cachedFileSize: 11202264, targetFileSize: 11202264 } +5ms
  download { cachedFile:
  download    '/Users/Evan/.cache/prisma/master/2accb9c7eacdc984874eaeb63377fe705dfd3203/darwin/query-engine' } +6ms
  download { cachedFileSize: 16570608, targetFileSize: 16570608 } +2ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin. Result:  { command:
   '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin --version',
  exitCode: 0,
  stdout: 'prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false } +43ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin. Result:  prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203 +28ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +1ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/migration-engine-darwin. Result:  { command:
   '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/migration-engine-darwin --version',
  exitCode: 0,
  stdout:
   'migration-engine-cli 2accb9c7eacdc984874eaeb63377fe705dfd3203',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false } +6ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/migration-engine-darwin. Result:  migration-engine-cli 2accb9c7eacdc984874eaeb63377fe705dfd3203 +0ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/introspection-engine-darwin. Result:  { command:
   '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/introspection-engine-darwin --version',
  exitCode: 0,
  stdout:
   'introspection-core 2accb9c7eacdc984874eaeb63377fe705dfd3203',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false } +1ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/introspection-engine-darwin. Result:  introspection-core 2accb9c7eacdc984874eaeb63377fe705dfd3203 +0ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin. Result:  { command:
   '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin --version',
  exitCode: 0,
  stdout: 'prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false } +2ms
  download Getting version of /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin. Result:  prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203 +1ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  getGenerators { binaryPathsWithEngineType:
  getGenerators    { 'query-engine':
  getGenerators       { darwin:
  getGenerators          '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin' } } } +0ms
  engineCommands getDMMF, override prismaPath = /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin +0ms
  engineCommands getConfig, override prismaPath = /Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin +43ms
  getos { platform: 'darwin', libssl: undefined } +220ms
{ prismaClientDir:
   '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/client' }
  getGenerators { outputPath:
  getGenerators    '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/client',
  getGenerators   generatorPath:
  getGenerators    '/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/client/generator-build/index.js' } +80ms
  Generator:/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/client/generator-build/index.js Sending "getManifest" rpc to generator +0ms
Error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:406:19)
    at writeOrBuffer (_stream_writable.js:394:5)
    at Socket.Writable.write (_stream_writable.js:294:11)
    at GeneratorProcess.sendMessage (/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/build/index.js:2:549424)
    at Promise (/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/build/index.js:2:549698)
    at new Promise (<anonymous>)
    at GeneratorProcess.getManifest (/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/build/index.js:2:549550)
    at Generator.<anonymous> (/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/build/index.js:2:745671)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/Evan/Documents/VSCode Projects/52hospital/api-server-experemental/node_modules/@prisma/cli/build/index.js:2:744951)

After changing folder name to "VSCodeProjects" it works fine.

Versions:

MacBook-Pro-Evan:api-server-experemental Evan$ npx prisma --version
(node:4702) ExperimentalWarning: The fs.promises API is experimental
@prisma/cli          : 2.0.0-beta.1
Current platform     : darwin
Query Engine         : prisma 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /Users/Evan/Documents/VSCodeProjects/52hospital/api-server-experemental/node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /Users/Evan/Documents/VSCodeProjects/52hospital/api-server-experemental/node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 2accb9c7eacdc984874eaeb63377fe705dfd3203 (at /Users/Evan/Documents/VSCodeProjects/52hospital/api-server-experemental/node_modules/@prisma/cli/introspection-engine-darwin)

@pantharshit00
Copy link
Contributor

I got a different error on mac.
image

@pantharshit00 pantharshit00 changed the title [Windows] generate does not work in folders with spaces generate does not work in folders with spaces Apr 7, 2020
@ivoilic
Copy link

ivoilic commented Apr 8, 2020

Can confirm. Same issue on OSX with Prisma 2 beta 2

@cmakohon
Copy link

I have been struggling with this issue for the better part of the day, and I can't believe it was as simple as removing a space from the parent path. Works for me now on Mac, thanks so much!

@Vandivier
Copy link

not so easy to fix for me on windows as the space is in my user folder
image

@timsuchanek
Copy link
Contributor

Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of @prisma/cli.
You can try it out with npm i -g @prisma/cli@alpha.

In case it’s not fixed for you - please let us know and we’ll reopen this issue!

@steebchen
Copy link
Contributor

We should add a test for this

@steebchen
Copy link
Contributor

steebchen commented Jun 2, 2020

This seems to be broken again. Plus, there's still no test for this specific case (created a dedicated issue for adding a test).

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/bug A reported bug. tech/typescript Issue for tech TypeScript. topic: prisma generate CLI: prisma generate topic: windows
Projects
None yet
Development

No branches or pull requests

10 participants