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

Example has an error, and does not work in node 16 (works in node 14) #500

Open
bok11 opened this issue Aug 31, 2021 · 1 comment
Open

Comments

@bok11
Copy link

bok11 commented Aug 31, 2021

I have been trying to follow your example, but it does not seem to work.

I get

Failed to compile.

/workdir/test/src/index.ts
TypeScript error in /workdir/ll/test/src/index.ts(15,32):
'>' expected.  TS1005

    13 | };
    14 | 
  > 15 | ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));
       |                                ^
    16 |

Steps to reproduce:

$ docker run --user $UID:$UID -p 3000:3000 -it -v $(pwd):/workdir node /bin/bash
$ cd workdir
$ yarn add typescript
$ npx create-react-app test --typescript
$ cd test
$ npm install .
$ npm install @open-rpc/docs-react @open-rpc/meta-schema --save
$ < use any editor to add index.ts>
$ npm start

I noticed that there are no .ts files present, though i i do
npx create-react-app test --template typescript
i will get index.tsx

This still fails with the same error though.

I tested in the latest node, and in node 14.

I can make it work in node 14 by using :
npx create-react-app test --template typescript

and editing index.tsx ( not renaming it to index.ts)

In node 16 when using --template, i get the following error:

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

Snippet for opening node14:
docker run --user $UID:$UID -p 3000:3000 -it -v $(pwd):/workdir node /bin/bash

@bok11
Copy link
Author

bok11 commented Aug 31, 2021

This works steps:

$ docker run --user $UID:$UID -p 3000:3000 -it -v $(pwd):/workdir node:14 /bin/bash
$ cd workdir
$ yarn add typescript
$ npx create-react-app test --template typescript
$ cd test
$ npm install .
$ npm install @open-rpc/docs-react @open-rpc/meta-schema --save
$ < use any editor to add index.ts>
$ npm start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant