prisma / prisma-client-js

Type-safe database client for TypeScript & Node.js (ORM replacement)
Apache License 2.0
1.47k stars 67 forks source link

Error: Cannot find module '@prisma/photon' For Prisma 2 Typescript examples #308

Closed Albert-Gao closed 4 years ago

Albert-Gao commented 4 years ago

Just git clone the latest prisma-examples

Go to typescript/graphql-auth or graphql-apollo-server,

run npm i

Round 1

error:

AlbertGao@Albert-LottoNZ-Laptop graphql-auth % npm i

> prisma2@2.0.0-preview016.2 install /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2
> node download-build/index.js || echo ""

> Downloading darwin binary for query-engine and migration-engine [====================] 100%

> core-js@2.6.10 postinstall /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/core-js
> node postinstall || echo "ignore"

> @prisma/sdk@0.0.60 postinstall /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/@prisma/sdk
> node scripts/download.js

> Downloading darwin binary for query-engine [====================] 100%

> graphql-shield@5.7.3 postinstall /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/graphql-shield
> lightercollective postinstall

                .,:;;:,.                
           .,:;rrssssssrr;:,.           
      .,:;rssssssssssssssssssr;:,.      
     ;rssssssssssssrrssssssssssssr;     
    .ssssssssssssr:  :rssssssssssss.    
    .rssssssr::;;:,::,:;;::rssssssr.    
     ;ssssss:  ;r:;ss;:r:  ;ssssss;     
     ,sssssss:;r:;ssss;:r::sssssss:     
      ;ssssss:,:rssssssr:,:ssssss;      
      .rssss:  ,;;;;;;;;,  ;ssssr.      
       .rsssr;;;::;::;;;;;;rsssr.       
        .;sssssssr:  :ssssssss;.        
          :rsssssssrrsssssssr:          
           .:rssssssssssssr:.           
             .:;rssssssr;,.             
                .,;;;;,.                

     *** Thank you for using graphql-shield! ***

  Please consider donating to our open collective
       to help us maintain this package.

  https://opencollective.com/graphql-shield/donate

                    ***

> graphql-auth@ postinstall /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth
> npm -s run generate

> Downloading darwin binary for query-engine [====================] 100%

Generating Photon.js to /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/@generated/photon
Done in 2.42s

Error: Failed to import photon package at @prisma/photon. The following error occured while trying:

        Error: Cannot find module '@prisma/photon'
Require stack:
- /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/dist/dmmf/utils.js
- /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/dist/dmmf/index.js
- /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/dist/builder.js
- /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/dist/index.js
- /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/src/schema.ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at Object.exports.get (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/dmmf/utils.ts:12:27)
    at new SchemaBuilder (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/builder.ts:164:38)
    at Object.build (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/builder.ts:91:19)
    at Object.onInstall (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/index.ts:43:16)
    at /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:700:44
    at Array.forEach (<anonymous>)
    at Object.exports.get (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/dmmf/utils.ts:14:11)
    at new SchemaBuilder (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/builder.ts:164:38)
    at Object.build (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/builder.ts:91:19)
    at Object.onInstall (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus-prisma/src/index.ts:43:16)
    at /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:700:44
    at Array.forEach (<anonymous>)
    at SchemaBuilder.beforeWalkTypes (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:694:18)
    at SchemaBuilder.getFinalTypeMap (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:784:10)
    at makeSchemaInternal (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:1571:15)
    at Object.makeSchema (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/nexus/src/builder.ts:1616:49)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ postinstall: `npm -s run generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ postinstall 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/AlbertGao/.npm/_logs/2019-11-24T11_10_55_995Z-debug.log
AlbertGao@Albert-LottoNZ-Laptop graphql-auth % 

In https://github.com/prisma/photonjs/issues/56 , it mentioned https://github.com/prisma/photonjs/pull/143 should fix it, I saw that merge, and there is no output in this schema.prisma, but still not working.

I already global installed prisma2. but still not working.

I am using Node v13.2.0, tried 12.13.0 without any luck.

Tried adding @prisma/photon and prisma2 to devDependencies, still not work. Error is different though.

=======================================

Round 2

After git reset --hard and rm -rf ./node_modules

I updated the prisma2 version in this project to 2.0.0-alpha.351: it asks me to install an @prisma/photon now! Exciting! But still error. :(

and I am using NPM but the command seems to use yarn?

> graphql-auth@ postinstall /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth
> npm -s run 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
yarn add v1.19.0
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
warning graphql-yoga > @types/graphql@14.5.0: This is a stub types definition. graphql provides its own type definitions, so you do not need this installed.
warning graphql-yoga > apollo-upload-server@7.1.0: Please migrate to https://npm.im/graphql-upload (see https://git.io/fADhl).
warning graphql-yoga > apollo-server-lambda > apollo-server-core > graphql-extensions > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
Couldn't find any versions for "@prisma/photon" that matches "b8d90fea39d266b128b4d748db5aca8505bb1026"
? Please choose a version of "@prisma/photon" from this list: 2.0.0-alpha.351
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > graphql-shield@5.7.3" has unmet peer dependency "graphql-middleware@^2.0.0 || ^3.0.0".
warning "graphql-yoga > graphql-playground-middleware-lambda@1.7.12" has unmet peer dependency "aws-lambda@^0.1.2".
warning "graphql-yoga > graphql-subscriptions@0.5.8" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-lambda > apollo-server-core@1.4.0" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-lambda > apollo-server-core > apollo-tracing@0.1.4" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-lambda > apollo-server-core > apollo-cache-control@0.1.1" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-lambda > apollo-server-core > graphql-extensions@0.0.10" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.19.1", while you're on "1.19.0".
info To upgrade, run the following command:
$ brew upgrade yarn
success Saved 120 new dependencies.
info Direct dependencies
β”œβ”€ @prisma/photon@2.0.0-alpha.351
β”œβ”€ bcryptjs@2.4.3
β”œβ”€ graphql-shield@5.7.3
β”œβ”€ graphql-yoga@1.18.3
β”œβ”€ graphql@14.5.8
β”œβ”€ jsonwebtoken@8.5.1
β”œβ”€ nexus-prisma@0.6.1
β”œβ”€ nexus@0.12.0-rc.5
└─ prisma2@2.0.0-alpha.351
info All dependencies
β”œβ”€ @babel/runtime@7.7.4
β”œβ”€ @prisma/photon@2.0.0-alpha.351
β”œβ”€ @types/aws-lambda@8.10.13
β”œβ”€ @types/body-parser@1.17.1
β”œβ”€ @types/connect@3.4.32
β”œβ”€ @types/cors@2.8.6
β”œβ”€ @types/express@4.17.2
β”œβ”€ @types/graphql-deduplicator@2.0.0
β”œβ”€ @types/graphql@14.5.0
β”œβ”€ @types/mime@2.0.1
β”œβ”€ @types/range-parser@1.2.3
β”œβ”€ @types/serve-static@1.13.3
β”œβ”€ @types/yup@0.26.18
β”œβ”€ @types/zen-observable@0.5.4
β”œβ”€ @wry/equality@0.1.9
β”œβ”€ accepts@1.3.7
β”œβ”€ apollo-cache-control@0.1.1
β”œβ”€ apollo-link@1.2.13
β”œβ”€ apollo-server-core@1.4.0
β”œβ”€ apollo-server-express@1.4.0
β”œβ”€ apollo-server-lambda@1.3.6
β”œβ”€ apollo-server-module-graphiql@1.4.0
β”œβ”€ apollo-tracing@0.1.4
β”œβ”€ apollo-upload-server@7.1.0
β”œβ”€ apollo-utilities@1.3.2
β”œβ”€ array-flatten@1.1.1
β”œβ”€ async-limiter@1.0.1
β”œβ”€ backo2@1.0.2
β”œβ”€ bcryptjs@2.4.3
β”œβ”€ body-parser-graphql@1.1.0
β”œβ”€ body-parser@1.19.0
β”œβ”€ buffer-equal-constant-time@1.0.1
β”œβ”€ busboy@0.2.14
β”œβ”€ camelcase@5.3.1
β”œβ”€ content-disposition@0.5.3
β”œβ”€ cookie-signature@1.0.6
β”œβ”€ cookie@0.4.0
β”œβ”€ core-js@2.6.10
β”œβ”€ cors@2.8.5
β”œβ”€ deprecated-decorator@0.1.6
β”œβ”€ destroy@1.0.4
β”œβ”€ dicer@0.2.5
β”œβ”€ ecdsa-sig-formatter@1.0.11
β”œβ”€ ee-first@1.1.1
β”œβ”€ eventemitter3@3.1.2
β”œβ”€ express@4.17.1
β”œβ”€ fast-json-stable-stringify@2.0.0
β”œβ”€ finalhandler@1.1.2
β”œβ”€ fn-name@2.0.1
β”œβ”€ forwarded@0.1.2
β”œβ”€ fs-capacitor@1.0.1
β”œβ”€ fs-extra@8.1.0
β”œβ”€ graphql-deduplicator@2.0.5
β”œβ”€ graphql-import@0.7.1
β”œβ”€ graphql-middleware@4.0.1
β”œβ”€ graphql-playground-middleware-express@1.7.11
β”œβ”€ graphql-playground-middleware-lambda@1.7.12
β”œβ”€ graphql-shield@5.7.3
β”œβ”€ graphql-subscriptions@0.5.8
β”œβ”€ graphql-tools@4.0.6
β”œβ”€ graphql-upload@8.1.0
β”œβ”€ graphql-yoga@1.18.3
β”œβ”€ graphql@14.5.8
β”œβ”€ http-errors@1.7.3
β”œβ”€ inherits@2.0.4
β”œβ”€ ipaddr.js@1.9.0
β”œβ”€ isarray@0.0.1
β”œβ”€ jsonfile@4.0.0
β”œβ”€ jsonwebtoken@8.5.1
β”œβ”€ jwa@1.4.1
β”œβ”€ jws@3.2.2
β”œβ”€ lightercollective@0.3.0
β”œβ”€ lodash.includes@4.3.0
β”œβ”€ lodash.isboolean@3.0.3
β”œβ”€ lodash.isinteger@4.0.4
β”œβ”€ lodash.isnumber@3.0.3
β”œβ”€ lodash.isplainobject@4.0.6
β”œβ”€ lodash.isstring@4.0.1
β”œβ”€ lodash.once@4.1.1
β”œβ”€ lodash@4.17.15
β”œβ”€ media-typer@0.3.0
β”œβ”€ merge-descriptors@1.0.1
β”œβ”€ methods@1.1.2
β”œβ”€ mime-db@1.42.0
β”œβ”€ mime-types@2.1.25
β”œβ”€ mime@1.6.0
β”œβ”€ negotiator@0.6.2
β”œβ”€ nexus-prisma@0.6.1
β”œβ”€ nexus@0.12.0-rc.5
β”œβ”€ object-assign@4.1.1
β”œβ”€ object-hash@1.3.1
β”œβ”€ path-to-regexp@0.1.7
β”œβ”€ pluralize@8.0.0
β”œβ”€ prisma2@2.0.0-alpha.351
β”œβ”€ property-expr@1.5.1
β”œβ”€ proxy-addr@2.0.5
β”œβ”€ raw-body@2.4.0
β”œβ”€ regenerator-runtime@0.13.3
β”œβ”€ resolve-from@4.0.0
β”œβ”€ safe-buffer@5.1.2
β”œβ”€ safer-buffer@2.1.2
β”œβ”€ semver@5.7.1
β”œβ”€ serve-static@1.14.1
β”œβ”€ source-map-support@0.5.16
β”œβ”€ source-map@0.6.1
β”œβ”€ string_decoder@0.10.31
β”œβ”€ subscriptions-transport-ws@0.9.16
β”œβ”€ symbol-observable@1.2.0
β”œβ”€ synchronous-promise@2.0.10
β”œβ”€ toposort@2.0.2
β”œβ”€ type-is@1.6.18
β”œβ”€ universalify@0.1.2
β”œβ”€ unpipe@1.0.0
β”œβ”€ utils-merge@1.0.1
β”œβ”€ uuid@3.3.3
β”œβ”€ vary@1.1.2
β”œβ”€ ws@5.2.2
β”œβ”€ yup@0.27.0
β”œβ”€ zen-observable-ts@0.8.20
└─ zen-observable@0.8.15
$ npm -s run generate
Error: Error: Command failed with ENOENT: /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/query-engine-darwin cli --dmmf
spawn /Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/query-engine-darwin ENOENT
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: 
    Error: Command failed with exit code 1: yarn add @prisma/photon@b8d90fea39d266b128b4d748db5aca8505bb1026
        at makeError (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/build/index.js:359510:11)
        at handlePromise (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/build/index.js:359755:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ postinstall: `npm -s run generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ postinstall 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/AlbertGao/.npm/_logs/2019-11-24T11_19_52_586Z-debug.log
AlbertGao@Albert-LottoNZ-Laptop graphql-auth % git diff
diff --git a/typescript/graphql-auth/package.json b/typescript/graphql-auth/package.json
index 317d1cba..fc5b37ab 100644
--- a/typescript/graphql-auth/package.json
+++ b/typescript/graphql-auth/package.json
@@ -13,6 +13,7 @@
     "seed": "ts-node prisma/seed"
   },
   "dependencies": {
+    "@prisma/photon": "^2.0.0-alpha.351",
     "bcryptjs": "2.4.3",
     "graphql": "14.5.8",
     "graphql-shield": "5.7.3",
@@ -27,7 +28,7 @@
     "@types/jsonwebtoken": "8.3.5",
     "@types/node": "12.12.12",
     "@types/ws": "6.0.3",
-    "prisma2": "2.0.0-preview016.2",
:...skipping...
diff --git a/typescript/graphql-auth/package.json b/typescript/graphql-auth/package.json
index 317d1cba..fc5b37ab 100644
--- a/typescript/graphql-auth/package.json
+++ b/typescript/graphql-auth/package.json
@@ -13,6 +13,7 @@
     "seed": "ts-node prisma/seed"
   },
   "dependencies": {
+    "@prisma/photon": "^2.0.0-alpha.351",
     "bcryptjs": "2.4.3",
     "graphql": "14.5.8",
     "graphql-shield": "5.7.3",
@@ -27,7 +28,7 @@
     "@types/jsonwebtoken": "8.3.5",
     "@types/node": "12.12.12",
     "@types/ws": "6.0.3",
-    "prisma2": "2.0.0-preview016.2",
+    "prisma2": "2.0.0-alpha.351",
     "ts-node": "8.5.2",
     "ts-node-dev": "1.0.0-pre.44",
     "typescript": "3.7.2"
~
~
~
~
~
AlbertGao@Albert-LottoNZ-Laptop graphql-auth % 

====================================

Round 3

After git reset --hard and rm -rf ./node_modules

This time I use yarn install with 2.0.0-alpha.351

Error :( ......

AlbertGao@Albert-LottoNZ-Laptop graphql-auth % yarn install
yarn install v1.19.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > graphql-shield@5.7.3" has unmet peer dependency "graphql-middleware@^2.0.0 || ^3.0.0".
warning "graphql-yoga > graphql-playground-middleware-lambda@1.7.12" has unmet peer dependency "aws-lambda@^0.1.2".
warning "graphql-yoga > graphql-subscriptions@0.5.8" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core@1.4.0" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-cache-control@0.1.1" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-tracing@0.1.4" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > graphql-extensions@0.0.10" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning " > nexus-prisma@0.6.1" has unmet peer dependency "@prisma/photon@^2.0.0-alpha.351".
[4/4] πŸ”¨  Building fresh packages...
$ npm -s run 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

yarn add v1.19.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
Couldn't find any versions for "@prisma/photon" that matches "b8d90fea39d266b128b4d748db5aca8505bb1026"
? Please choose a version of "@prisma/photon" from this list: 2.0.0-alpha.351
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > graphql-shield@5.7.3" has unmet peer dependency "graphql-middleware@^2.0.0 || ^3.0.0".
warning "graphql-yoga > graphql-playground-middleware-lambda@1.7.12" has unmet peer dependency "aws-lambda@^0.1.2".
warning "graphql-yoga > graphql-subscriptions@0.5.8" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core@1.4.0" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-cache-control@0.1.1" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-tracing@0.1.4" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > graphql-extensions@0.0.10" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @prisma/photon@2.0.0-alpha.351
info All dependencies
└─ @prisma/photon@2.0.0-alpha.351
$ npm -s run generate
> Downloading darwin binary for query-engine [====================] 100%

Generating Photon.js to ./node_modules/@prisma/photon
Done in 2.58s

sh: ts-node: command not found
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: 
    Error: Command failed with exit code 1: yarn add @prisma/photon@b8d90fea39d266b128b4d748db5aca8505bb1026
        at makeError (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/build/index.js:359510:11)
        at handlePromise (/Users/AlbertGao/codes/temp/prisma-examples/typescript/graphql-auth/node_modules/prisma2/build/index.js:359755:26)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
AlbertGao@Albert-LottoNZ-Laptop graphql-auth % 

Interesting, because ts-node is in the devDep, or is it the command it tried to run?

=====================

I think Round 3 is close? If that is the case, can we use npm or have to use yarn?

I think the easy way to solve it is to update the dep list in package.json? To include the @prisma/photon?

What am I missing? Thanks :)

Albert-Gao commented 4 years ago

Round 4

After adding @prisma/photon to dep list, seems it is working?

......
..... 
> graphql-auth@ postinstall /Users/AlbertGao/codes/temp/prisma2-ts-graphql-auth
> npm -s run generate
> Downloading darwin binary for query-engine [====================] 100%

Generating Photon.js to ./node_modules/@prisma/photon
Done in 2.64s

You should specify a configuration value for outputs in Nexus' makeSchema. Provide one to remove this warning.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN graphql-shield@5.7.3 requires a peer of graphql-middleware@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN graphql-playground-middleware-lambda@1.7.12 requires a peer of aws-lambda@^0.1.2 but none is installed. You must install peer dependencies yourself.
npm WARN graphql-subscriptions@0.5.8 requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN apollo-server-core@1.4.0 requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN apollo-cache-control@0.1.1 requires a peer of graphql@0.10.x - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN apollo-tracing@0.1.4 requires a peer of graphql@0.10.x - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN graphql-extensions@0.0.10 requires a peer of graphql@0.10.x - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN graphql-auth@ No repository field.

added 385 packages from 350 contributors and audited 787 packages in 23.387s

2 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
AlbertGao@Albert-LottoNZ-Laptop prisma2-ts-graphql-auth % 

This warning You should specify a configuration value for outputs in Nexus' makeSchema. Provide one to remove this warning.

needs to fix or just ignore?

Anyway, the npm run start and npm run build have errors:

AlbertGao@Albert-LottoNZ-Laptop prisma2-ts-graphql-auth % npm run start

> graphql-auth@ start /Users/AlbertGao/codes/temp/prisma2-ts-graphql-auth
> node dist/server

internal/modules/cjs/loader.js:957
    throw err;
    ^

Error: Cannot find module '/Users/AlbertGao/codes/temp/prisma2-ts-graphql-auth/dist/server'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:67:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ start: `node dist/server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ start 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/AlbertGao/.npm/_logs/2019-11-24T12_01_11_331Z-debug.log
AlbertGao@Albert-LottoNZ-Laptop prisma2-ts-graphql-auth % npm run build

> graphql-auth@ build /Users/AlbertGao/codes/temp/prisma2-ts-graphql-auth
> npm -s run clean && npm -s run generate && tsc

> Downloading darwin binary for query-engine [====================] 100%

Generating Photon.js to ./node_modules/@prisma/photon
Done in 2.70s

You should specify a configuration value for outputs in Nexus' makeSchema. Provide one to remove this warning.
src/context.ts:1:24 - error TS2307: Cannot find module '@generated/photon'.

1 import { Photon } from '@generated/photon'
                         ~~~~~~~~~~~~~~~~~~~

src/types/Post.ts:6:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"Post">'.

6     t.model.id()
        ~~~~~

src/types/Post.ts:9:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"Post">'.

9     t.model.published()
        ~~~~~

src/types/Post.ts:10:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"Post">'.

10     t.model.title()
         ~~~~~

src/types/Post.ts:11:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"Post">'.

11     t.model.content()
         ~~~~~

src/types/Post.ts:12:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"Post">'.

12     t.model.author()
         ~~~~~

src/types/User.ts:6:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.

6     t.model.id()
        ~~~~~

src/types/User.ts:7:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.

7     t.model.name()
        ~~~~~

src/types/User.ts:8:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.

8     t.model.email()
        ~~~~~

src/types/User.ts:9:7 - error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.

9     t.model.posts({ pagination: false })
        ~~~~~

Found 10 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! graphql-auth@ build: `npm -s run clean && npm -s run generate && tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the graphql-auth@ build 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/AlbertGao/.npm/_logs/2019-11-24T12_01_28_316Z-debug.log
AlbertGao@Albert-LottoNZ-Laptop prisma2-ts-graphql-auth % 
Albert-Gao commented 4 years ago

Move to https://github.com/prisma/prisma-examples/issues/1024