Closed idkjs closed 5 years ago
It happened because the project hasn't initialized with lerna. This project uses lerna hoisting to avoid reason module conflicts.
To fix this problem, follow these steps.
Go to the root of the project directory, not the snippet root or project root. It should be the project root directory that has snippets
, packages
folder.
Then, execute this command
npx lerna bootstrap
@sainthkh thanks for the lerna guidance. Works. Peace to you, sir.
Hi @sainthkh.
Still trying to get this going. Lots of hope for this project.
I have an example repo: https://github.com/idkjs/reasonql-hello-world
Steps are:
cd packages/server && npm start
cd ../client && npm run reasonql:dev
npm run reasonql:dev
npm start
This produces the following error:
client npm start
> hello-world-client@0.1.0 start /Users/prisc_000/Downloads/reasonql-hello-world/packages/client
> bsb -make-world -w
File "/Users/prisc_000/Downloads/reasonql-hello-world/node_modules/@reasonql/core/bsconfig.json", line 1
Error: Invalid json format
>>>> Start compiling
[3/3] Building src/.reasonql/AppQuery.mlast.d
[1/3] Building src/App-HelloWorldClient.cmj
We've found a bug for you!
/Users/prisc_000/Downloads/reasonql-hello-world/packages/client/src/App.re 8:16-35
6 │ type state = {
7 │ status: queryStatus,
8 │ data: option(AppQuery.queryResult),
9 │ }
10 │
This type constructor's parameter, `AppQuery.queryResult`, can't be found. Is it a typo?
[2/3] Building src/.reasonql/AppQuery-HelloWorldClient.cmj
>>>> Finish compiling(exit: 1)
^Cnpm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! hello-world-client@0.1.0 start: `bsb -make-world -w`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the hello-world-client@0.1.0 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/prisc_000/.npm/_logs/2019-04-29T08_23_33_384Z-debug.log
If i upgrade the reasonql deps from the demo to latest i get:
client [master*]npm start
> hello-world-client@0.1.0 start /Users/prisc_000/Downloads/reasonql-hello-world/packages/client
> bsb -make-world -w
File "/Users/prisc_000/Downloads/reasonql-hello-world/node_modules/@reasonql/core/bsconfig.json", line 1
Error: Invalid json format
>>>> Start compiling
[3/3] Building src/.reasonql/AppQuery.mlast.d
[2/3] Building src/App-HelloWorldClient.cmj
We've found a bug for you!
/Users/prisc_000/Downloads/reasonql-hello-world/packages/client/src/App.re
It's possible that your build is stale.
Try to clean the artifacts and build again?
Here's the original error message
The files /Users/prisc_000/Downloads/reasonql-hello-world/node_modules/bs-platform/lib/ocaml/pervasives.cmi
and /Users/prisc_000/Downloads/reasonql-hello-world/node_modules/reason-react/lib/ocaml/reasonReact.cmi
make inconsistent assumptions over interface Pervasives
>>>> Finish compiling(exit: 1)
FYI i guess. I havent been able to figure out what is going on.
Thanks.
Thank you for telling me about the bug. The problem was that I didn't include bsconfig.json to @reasonql/core bundle.
I included that and released 0.1.4.
Please do below to your error repo.
@sainthkh thanks for that.
The hello-world runs.
Running the mutations snippet throws the following errors:
On client:
➜ client yarn start
yarn run v1.15.2
warning ../../../../../package.json: No license field
$ bsb -make-world -w
ninja: no work to do.
ninja: no work to do.
>>>> Start compiling
[1/1] Building MutationClient.cmi
[1/2] Building src/App-MutationClient.cmj
We've found a bug for you!
/Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client/src/App.re 13:17-36
11 │
12 │ type action =
13 │ | InitialLoad(AppQuery.queryResult)
14 │ | OptimisticPrepend(Types.tweet)
15 │ | Prepend(SaveTweetMutation.queryResult)
The module or file AppQuery can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `bsb` instead of `bsb -make-world`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?
>>>> Finish compiling(exit: 1)
>>>> Start compiling
[1/1] Building MutationClient.cmi
[1/2] Building src/App-MutationClient.cmj
We've found a bug for you!
/Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client/src/App.re 13:17-36
11 │
12 │ type action =
13 │ | InitialLoad(AppQuery.queryResult)
14 │ | OptimisticPrepend(Types.tweet)
15 │ | Prepend(SaveTweetMutation.queryResult)
The module or file AppQuery can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `bsb` instead of `bsb -make-world`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?
>>>> Finish compiling(exit: 1)
^C
➜ client npm run clean
> mutation-client@0.1.0 clean /Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client
> bsb -clean-world
Cleaning... 5 files.
Cleaning... 36 files.
Cleaning... 20 files.
➜ client npm run reasonql
> mutation-client@0.1.0 reasonql /Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client
> reasonql-compiler -w
removing .reasonql directory...
[08:01:18AM] compile started
loading schema...
parsing the schema file...
Error schema isn't defined. Skip this step.
No enum types. Skip this phase.
analyzing reason files...
/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155
throw unexpected(lexer);
^
GraphQLError: Syntax Error: Unexpected |
at syntaxError (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/error/syntaxError.js:24:10)
at unexpected (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1483:33)
at parseDefinition (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155:9)
at many (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1516:16)
at parseDocument (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:115:18)
at parse (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:50:10)
at gqlCodes.map.code (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:7:15)
at Array.map (<anonymous>)
at generateNodes (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:6:24)
at generateTypeFiles (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/compiler.js:165:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mutation-client@0.1.0 reasonql: `reasonql-compiler -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mutation-client@0.1.0 reasonql 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/prisc_000/.npm/_logs/2019-04-30T06_01_18_634Z-debug.log
➜ client pwd
/Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client
➜ client
Running the reasonql script:
client yarn reasonql
yarn run v1.15.2
warning ../../../../../package.json: No license field
$ reasonql-compiler -w
removing .reasonql directory...
[07:57:33AM] compile started
loading schema...
parsing the schema file...
Error schema isn't defined. Skip this step.
No enum types. Skip this phase.
analyzing reason files...
/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155
throw unexpected(lexer);
^
GraphQLError: Syntax Error: Unexpected |
at syntaxError (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/error/syntaxError.js:24:10)
at unexpected (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1483:33)
at parseDefinition (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155:9)
at many (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1516:16)
at parseDocument (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:115:18)
at parse (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:50:10)
at gqlCodes.map.code (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:7:15)
at Array.map (<anonymous>)
at generateNodes (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:6:24)
at generateTypeFiles (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/compiler.js:165:15)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ client npm run reasonql
> mutation-client@0.1.0 reasonql /Users/prisc_000/Downloads/reasonql-master/snippets/mutation/client
> reasonql-compiler -w
removing .reasonql directory...
[08:29:26AM] compile started
loading schema...
parsing the schema file...
Error schema isn't defined. Skip this step.
No enum types. Skip this phase.
analyzing reason files...
/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155
throw unexpected(lexer);
^
GraphQLError: Syntax Error: Unexpected |
at syntaxError (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/error/syntaxError.js:24:10)
at unexpected (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1483:33)
at parseDefinition (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:155:9)
at many (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:1516:16)
at parseDocument (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:115:18)
at parse (/Users/prisc_000/Downloads/reasonql-master/node_modules/graphql/language/parser.js:50:10)
at gqlCodes.map.code (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:7:15)
at Array.map (<anonymous>)
at generateNodes (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/graphql-to-reason/node.js:6:24)
at generateTypeFiles (/Users/prisc_000/Downloads/reasonql-master/packages/compiler/src/compiler.js:165:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mutation-client@0.1.0 reasonql: `reasonql-compiler -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mutation-client@0.1.0 reasonql 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/prisc_000/.npm/_logs/2019-04-30T06_29_26_781Z-debug.log
➜ client
Thank you for telling me another bug.
There was a problem in regex of tagFinder.js.
Change the compiler version and do it again. It'll work.
Running the updated mutation example, it looks like the compiler is creating and EnumType where there isn't one defined in the schema.
➜ client [master*]yarn start
yarn run v1.15.2
warning ../../../../../../package.json: No license field
$ bsb -make-world -w
ninja: no work to do.
ninja: no work to do.
>>>> Start compiling
[5/5] Building..ppQuery.mlast.d
[1/4] Building..ationClient.cmj
We've found a bug for you!
/Users/prisc_000/working/EXAMPLES/reasonql/snippets/mutation/client/src/.reasonql/SaveTweetMutation.re 30:10-29
28 │
29 │ type variablesType = {
30 │ tweet: EnumTypes.tweetInput,
31 │ };
32 │
The module or file EnumTypes can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `bsb` instead of `bsb -make-world`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?
[2/4] Building..ationClient.cmj
>>>> Finish compiling(exit: 1)
Fixed it. Compiler became 0.1.4.
Nice. Looks like last issue in running the examples is in auth with compiler and enum again. compiler version seems right.
ls
auth enum fragments hello-world mutation
➜ snippets [master*]auth
➜ auth [master*]client
➜ client [master*]npm run reasonql
> auth-client@0.1.0 reasonql /Users/prisc_000/working/EXAMPLES/reasonql/snippets/auth/client
> reasonql-compiler
removing .reasonql directory...
[12:48:35PM] compile started
loading schema...
parsing the schema file...
No enum types. Skip this phase.
analyzing reason files...
/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/graphql-to-reason/type.js:139
let isEnum = typeMap[field.type].enum;
^
TypeError: Cannot read property 'enum' of undefined
at args.map.arg (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/graphql-to-reason/type.js:139:38)
at Array.map (<anonymous>)
at argumentTypes (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/graphql-to-reason/type.js:137:21)
at gqlCodes.map.code (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/graphql-to-reason/node.js:29:13)
at Array.map (<anonymous>)
at generateNodes (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/graphql-to-reason/node.js:6:24)
at generateTypeFiles (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/compiler.js:165:15)
at compileAll (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/compiler.js:47:3)
at Object.<anonymous> (/Users/prisc_000/working/EXAMPLES/reasonql/packages/compiler/src/cli.js:25:1)
at Module._compile (internal/modules/cjs/loader.js:816:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! auth-client@0.1.0 reasonql: `reasonql-compiler`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the auth-client@0.1.0 reasonql 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/prisc_000/.npm/_logs/2019-04-30T10_48_35_634Z-debug.log
➜ client [master*]cat package.json
{
"name": "auth-client",
"version": "0.1.0",
"scripts": {
"build": "bsb -make-world",
"start": "bsb -make-world -w",
"clean": "bsb -clean-world",
"test": "echo \"Error: no test specified\" && exit 1",
"reasonql": "reasonql-compiler",
"webpack": "webpack -w",
"webpack:production": "NODE_ENV=production webpack",
"server": "webpack-dev-server"
},
"keywords": [
"BuckleScript"
],
"author": "",
"license": "MIT",
"dependencies": {
"@reasonql/core": "^0.1.4",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"reason-react": "^0.5.3"
},
"devDependencies": {
"@reasonql/compiler": "^0.1.4",
"bs-platform": "^4.0.18",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.0.1",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.8"
}
}
➜ client [master*]
Fixed it. Sorry for the buggy software.
Thank you for getting this started, brother. Learning a lot reading your code.
I'm trying to run the hello world example how of the snippets directory.
I have cloned this repo then moved in to the hello world directory.
After running
npm i
, thennpm start
the compiler complains:Is this a namespace thing? How would we resolve this?
Thanks for the effort on this!