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 generate tries to install @prisma/photon even in folder without package.json #1147

Closed
janpio opened this issue Dec 15, 2019 · 2 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. topic: cli topic: prisma generate CLI: prisma generate
Milestone

Comments

@janpio
Copy link
Member

janpio commented Dec 15, 2019

I created a project by creating a folder and copying a prisma/schema.prisma into it. Then I ran prisma2 generate to see what would happen:

C:\Users\Jan\Documents\throwaway\modelTest>prisma2 generate
In order to use the "photonjs" generator, you need to install @prisma/photon to your project.
√ Do you want to install it now? ... yes

> @prisma/photon@2.0.0-preview018 postinstall C:\Users\Jan\Documents\node_modules\@prisma\photon
> node scripts/generate.js

npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Jan\Documents\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jan\Documents\package.json'
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.

+ @prisma/photon@2.0.0-preview018
added 1 package and audited 2 packages in 8.126s
found 0 vulnerabilities

> Downloading Prisma engines for windows [====================] 100%



Generating Photon.js to .\..\..\node_modules\@prisma\photon
Done in 3.76s

Seems it found a node_modules folder 2 levels up, where it then installed both Photon and also generated the client. Not sure if this is good behaviour.

@divyenduz
Copy link
Contributor

divyenduz commented Jan 9, 2020

@janpio : This is a design decision that we made and I would like to get it changed.

Also: It creates package.json inside prisma/ folder when package.json does not exist at the top-level.

This one almost always gets me with me ending up in a project structure that has 2 package.json files once I set it up manually.

I would rather fail or have the cwd() where we create package.json.

Marking this as a candidate for further discussion.

@janpio janpio added the topic: prisma generate CLI: prisma generate label Jan 9, 2020
@timsuchanek timsuchanek added this to the Preview 20 milestone Jan 16, 2020
@timsuchanek
Copy link
Contributor

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

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

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. topic: cli topic: prisma generate CLI: prisma generate
Projects
None yet
Development

No branches or pull requests

4 participants