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

prisma2 init does not find ts-node when using starter kit "GraphQL API (+ Auth)" #482

Closed
joeyaurel opened this issue Sep 2, 2019 · 9 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. kind/regression A reported bug in functionality that used to work before.
Milestone

Comments

@joeyaurel
Copy link

Using Prisma 2 version: prisma2@2.0.0-preview-9.1, binary version: bbbeff6f84b408e534ebd866bfd378748e6d6611

When running prisma2 init with the GraphQL API (+ Auth)starter kit I came across the following error. I assume that the npm install did not install everything:

...

✔  Downloading the starter kit from GitHub ...

Preparing your starter kit: GraphQL API (+ Auth)

✔  Downloading the starter kit from GitHub ...
✔  Extracting content to prisma2preview91 ...
✔  Installing dependencies with: `npm install` ...
✔  Preparing your database ...
⠼  Seeding your database with: `npm run seed` ...
 ERROR  Error during command execution

sh: ts-node: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! graphql-auth@ seed: `ts-node prisma/seed.ts`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the graphql-auth@ seed script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nickreynke/.npm/_logs/2019-09-02T17_20_11_738Z-debug.log

After running a npm i I could run npm run seed successfully.

@pantharshit00
Copy link
Contributor

I can confirm this. It is an easy workaround for now as you just need to run npm install again.

@joeyaurel
Copy link
Author

joeyaurel commented Sep 8, 2019

FYI: Still occurs in version prisma2@2.0.0-preview-10, binary version: 1b0c271f14ca00606f56c93717e228fe48c5603c

@ttsirkia
Copy link

npm install -g typescript ts-node ts-node-dev seems to be sufficient for the starter kits.

@divyenduz
Copy link
Contributor

@ttsirkia Yes, the issue however is that these dev deps exist and are installed but for some reason ts-node doesn't go through. I will investigate this soon.

@divyenduz
Copy link
Contributor

On further digging, I can confirm that using the bin.ts from introspection directly works but when it is used from Prisma 2 CLI's bin.ts it fails with this error as we pass in a different cwd.

That is used here and it breaks the ts-node resolution: https://github.com/prisma/lift/blob/master/src/cli/commands/LiftTmpPrepare.ts#L9-L42

Tim informed me that a proper fix for this is to refactor the cwd resolution for Prisma schema path resolution which is a relatively larger refactor.

Handing this one over to @timsuchanek

@timsuchanek
Copy link
Contributor

Fixed in the latest alpha.

@divyenduz
Copy link
Contributor

divyenduz commented Sep 27, 2019

I can still reproduce this with alpha.216. At least with the create folder feature of init.

prisma2 init <folder>


Note that the workaround of manually running npm install in the project still works.

@divyenduz divyenduz added process/candidate kind/regression A reported bug in functionality that used to work before. labels Sep 27, 2019
@janpio janpio modified the milestones: Preview 13, Preview 14 Sep 27, 2019
@joeyaurel
Copy link
Author

Can confirm that the same procedure still fails when using version prisma2@2.0.0-preview-13, binary version: 14576370b55d5152d9cb90f4f509bfa56760dbbd.

@timsuchanek
Copy link
Contributor

Apologies for the problems! We released a patch to fix this!

timsuchanek added a commit that referenced this issue Apr 14, 2020
Validate dmmf against denylists - fixes #363

Former-commit-id: 3665341
timsuchanek added a commit that referenced this issue Apr 14, 2020
Validate dmmf against denylists - fixes #363

Former-commit-id: 3665341
Former-commit-id: 3e98719
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. kind/regression A reported bug in functionality that used to work before.
Projects
None yet
Development

No branches or pull requests

6 participants