microsoft / TypeScript-React-Starter

A starter template for TypeScript and React with a detailed README describing how to use the two together.
MIT License
11.08k stars 1.21k forks source link

Cannot make it work #240

Open painreign opened 5 years ago

painreign commented 5 years ago

I first clone master repository, then do: npm install npm run start

node version: 11.3.0

and then i get this output: Failed to compile.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts (368,15): error TS2304: Cannot find name 'Cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts (640,69): error TS2304: Cannot find name 'Cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts (13,23): error TS2688: Cannot find type definition file for 'cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (5,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (7,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (10,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (12,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (15,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (17,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (20,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (21,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (26,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx (27,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/App.tsx (5,14): error TS2304: Cannot find name 'require'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/App.test.tsx (5,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json error TS2688: Cannot find type definition file for 'cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json error TS2688: Cannot find type definition file for 'jest'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json error TS2688: Cannot find type definition file for 'node'.

xerotolerant commented 5 years ago

Create our new project We'll create a new project called my-app:

create-react-app my-app --scripts-version=react-scripts-ts

The readme.md clearly states that you use it this way. not the way you described

painreign commented 5 years ago

i see thank you, however this is not clear.

I don't see much value in repository if it doesn't work. Probably you should make repository working instead of telling how to fix it in README

I am sorry but I don't get this point. Could you explain the idea how broken repository should be used and why you are keeping it with kind of duplicating information in README?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/TypeScript-React-Starter/issues/240#issuecomment-443385827, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5XS5Y6h5QDHSAKAb2Di2Ig0DV4sNCzks5u0dfJgaJpZM4Y75Mq .

web1992 commented 5 years ago

@painreign

I think you node version 11.3.0 is newly then the TypeScript-React-Starter create.

The two way to solve:

I use Upgrades packages to their latest version ,here is step:

Upgrades packages to their latest version

yarn upgrade --latest

and then fix source file index.tsx

+ import { EnthusiasmAction } from './actions/index';
-  const store = createStore<StoreState>(enthusiasm, {
+ const store = createStore<StoreState, EnthusiasmAction, any, any>(enthusiasm, {

and then fix source file Hello.tsx

-- import { connect, Dispatch } from 'react-redux';
++ import { connect } from 'react-redux';
++ import { Dispatch } from 'redux';

Why you must fix source file , some packages(like redux) not incompatible with new version.

My node version is v10.14.1

ramondeklein commented 5 years ago

I have created a pull-request #242 to make it work with NodeJS v10 and React v16. I hope it will be integrated soon.

yanlee26 commented 5 years ago

issues still exist...

NinthDesertDude commented 5 years ago

I got the exact same results of OP while strictly following the README. Didn't change anything, not even choosing a different name than my-app.