Javascriptservices: React with Redux show many errors when creating

Created on 13 Jan 2017  路  9Comments  路  Source: aspnet/JavaScriptServices

It is normal that this happens?

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
log  : Restoring packages for z:\projects\temp\ReactRedux\project.json...
log  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in z:\projects\temp\ReactRedux\project.json...
log  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in z:\projects\temp\ReactRedux\project.json...
log  : Restoring packages for tool 'Microsoft.DotNet.Watcher.Tools' in z:\projects\temp\ReactRedux\project.json...
log  : Writing lock file to disk. Path: z:\projects\temp\ReactRedux\project.lock.json
log  : z:\projects\temp\ReactRedux\project.json
log  : Restore completed in 5476ms.
Hash: 9e03fe6cec5d8398598c3aab4069bb548ad173b3
Version: webpack 1.14.0
Child
    Hash: 9e03fe6cec5d8398598c
    Version: webpack 1.14.0
    Time: 3651ms
                                   Asset     Size  Chunks             Chunk Names
    89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
                               vendor.js  1.73 MB       0  [emitted]  vendor
                              vendor.css   315 kB       0  [emitted]  vendor
       [0] dll vendor 12 bytes {0} [built]
        + 374 hidden modules

    WARNING in ./~/node-libs-browser/~/process/browser.js
    There is another module with an equal name when case is ignored.
    This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
    Rename module if multiple modules are expected or use equal casing if one module is expected.

    WARNING in Z:/projects/temp/ReactRedux/~/node-libs-browser/~/process/browser.js
    There is another module with an equal name when case is ignored.
    This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
    Rename module if multiple modules are expected or use equal casing if one module is expected.
    Child extract-text-webpack-plugin:
            + 7 hidden modules
Child
    Hash: 3aab4069bb548ad173b3
    Version: webpack 1.14.0
    Time: 3638ms
                                   Asset     Size  Chunks             Chunk Names
    89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
                               vendor.js  1.97 MB       0  [emitted]  vendor
       [0] dll vendor 12 bytes {0} [built]
        + 352 hidden modules
Hash: fc566f2f18fd46265e2059f70807ccc31b057bb8
Version: webpack 1.14.0
Child
    Hash: fc566f2f18fd46265e20
    Version: webpack 1.14.0
    Time: 4003ms
                 Asset      Size  Chunks             Chunk Names
        main-client.js   43.4 kB       0  [emitted]  main-client
              site.css   1.56 kB       0  [emitted]  main-client
    main-client.js.map   30.3 kB       0  [emitted]  main-client
          site.css.map  85 bytes       0  [emitted]  main-client
        + 23 hidden modules

    ERROR in Z:\projects\temp\ReactRedux\node_modules\typescript\lib\lib.dom.d.ts
    (7552,11): error TS2300: Duplicate identifier 'History'.

    ERROR in Z:\projects\temp\ReactRedux\node_modules\typescript\lib\lib.dom.d.ts
    (7562,13): error TS2300: Duplicate identifier 'History'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router-redux\node_modules\@types\history\index.d.ts
    (6,21): error TS2300: Duplicate identifier 'History'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\createMemoryHistory.d.ts
    (3,57): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryOptions'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,19): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryOptions'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,35): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryQueries'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,51): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRoutes.d.ts
    (4,48): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRoutes.d.ts
    (4,69): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\routerHistory.d.ts
    (10,46): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\routerHistory.d.ts
    (20,39): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryQueries'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Redirect.d.ts
    (14,19): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\IndexRedirect.d.ts
    (12,16): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (4,5): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'QueryString'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (4,18): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (112,56): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index".History' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (113,56): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index".History' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\history\index.d.ts
    (5,21): error TS2300: Duplicate identifier 'History'.

    ERROR in z:\projects\temp\ReactRedux\ClientApp\boot-server.tsx
    (5,33): error TS2307: Cannot find module 'history/lib/createMemoryHistory'.

    ERROR in ./ClientApp/boot-client.tsx
    (21,17): error TS2322: Type 'ReactRouterReduxHistory' is not assignable to type 'History'.

    ERROR in ./ClientApp/boot-client.tsx
    (21,17): error TS2322: Type 'ReactRouterReduxHistory' is not assignable to type 'History'.
      Property 'length' is missing in type 'ReactRouterReduxHistory'.
    Child extract-text-webpack-plugin:
            + 2 hidden modules
Child
    Hash: 59f70807ccc31b057bb8
    Version: webpack 1.14.0
    Time: 3991ms
             Asset     Size  Chunks             Chunk Names
    main-server.js  86.3 kB       0  [emitted]  main-server
        + 21 hidden modules

    ERROR in Z:\projects\temp\ReactRedux\node_modules\typescript\lib\lib.dom.d.ts
    (7552,11): error TS2300: Duplicate identifier 'History'.

    ERROR in Z:\projects\temp\ReactRedux\node_modules\typescript\lib\lib.dom.d.ts
    (7562,13): error TS2300: Duplicate identifier 'History'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router-redux\node_modules\@types\history\index.d.ts
    (6,21): error TS2300: Duplicate identifier 'History'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\createMemoryHistory.d.ts
    (3,57): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryOptions'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,19): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryOptions'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,35): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryQueries'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRouterHistory.d.ts
    (1,51): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRoutes.d.ts
    (4,48): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\useRoutes.d.ts
    (4,69): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'CreateHistory'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\routerHistory.d.ts
    (10,46): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\routerHistory.d.ts
    (20,39): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'HistoryQueries'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Redirect.d.ts
    (14,19): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\IndexRedirect.d.ts
    (12,16): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (4,5): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'QueryString'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (4,18): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index"' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (112,56): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index".History' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\react-router\lib\Router.d.ts
    (113,56): error TS2305: Module '"z:/projects/temp/ReactRedux/node_modules/@types/history/index".History' has no exported member 'Query'.

    ERROR in z:\projects\temp\ReactRedux\node_modules\@types\history\index.d.ts
    (5,21): error TS2300: Duplicate identifier 'History'.

    ERROR in ./ClientApp/boot-server.tsx
    (5,33): error TS2307: Cannot find module 'history/lib/createMemoryHistory'.

    ERROR in z:\projects\temp\ReactRedux\ClientApp\boot-client.tsx
    (21,17): error TS2322: Type 'ReactRouterReduxHistory' is not assignable to type 'History'.

    ERROR in z:\projects\temp\ReactRedux\ClientApp\boot-client.tsx
    (21,17): error TS2322: Type 'ReactRouterReduxHistory' is not assignable to type 'History'.
      Property 'length' is missing in type 'ReactRouterReduxHistory'.

Most helpful comment

I've also run into this. I had to make the following adjustments to my package.json to get things working again:

    "@types/react-router": "2.0.42",
    "@types/react-router-redux": "4.0.36",
    "@types/history": "2.0.44",

All 9 comments

No thats not normal and i noticed it as well today when generating a new template after having updated yo & aspnetcore-spa generator.

I tried copying my old node_modules from a week old project (same package file), replacing the ones downloaded in the new project and the errors disappeared.

I've also run into this. I had to make the following adjustments to my package.json to get things working again:

    "@types/react-router": "2.0.42",
    "@types/react-router-redux": "4.0.36",
    "@types/history": "2.0.44",

I'm looking into it now, previously react-router-redux had some typings issues in it's declaration files. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/10686#event-921092256, which then the fixes got merged in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/13642 a few days ago.

The template is using "@types/react-router-redux": "^4.0.30", with ^ so it picks up the latest version.

So the History (@types/history) definition files had some serious updates recently: you can see them in this commit, https://github.com/DefinitelyTyped/DefinitelyTyped/commit/a1abf4fd44d411c689300f1c9fa99dc83e4de091

So although the react-redux-router types fixes would have helped, the 2 are now colliding.

@SapientGuardian is correct in that the types should be pinned for now.

Just made a PR for it here #586

Hmm, just wondering if the the problem is in @types/react-router-redux or @types/react-router?

$ npm install @types/react-router-redux
`-- @types/[email protected]
  +-- @types/[email protected]
  +-- @types/[email protected]
  | `-- @types/[email protected]
  `-- [email protected]
    +-- [email protected]
    +-- [email protected]
    +-- [email protected]
    | `-- [email protected]
    `-- [email protected]

...got @types/[email protected] as expected

$ npm install @types/react-router
`-- @types/[email protected]
  +-- @types/[email protected]
  `-- @types/[email protected]

...got @types/[email protected], expected @types/[email protected]

Also noticed the following in the package.json for @types/react-router...

  "version": "2.0.44",
  "dependencies":
  {
    "@types/history": "*",
    "@types/react": "*"
  }, ...

Could another way to fix be to set "@types/history": "~2.0.44" instead?
Where are these dependent versions set for @types?

Yup I have the same issue, seems to be installing version 4.x.x, fixed temporarily on my end by adding

"@types/history": "^2.0.44"

to my own dependency list.

Thanks for reporting this. Fixed in f8714e9.

@olafurw Thanks!

Anytime Chuck Norris.

@SteveSandersonMS

Quick question - will the published Yo generator be updated shortly with this fix, or do I have to be a bit more patient? ;) (Updated my copy just now but problem persists).

Edit:

Just copied the changed files from your commit f8714e9 into the relevant locations (on windows):

C:\Users\{Username}\AppData\Roaming\npmnode_modules\generator-aspnetcore-spa\app\templates\

All working - very happy 馃憤

Was this page helpful?
0 / 5 - 0 ratings