Javascriptservices: Generated example publishing to the server - typescript errors

Created on 15 Jul 2017  路  4Comments  路  Source: aspnet/JavaScriptServices

I've generated asp sample by:

yo aspnetcore-spa

During generation I have chosen _react with redux_ option.

Example works locally fine but now I'd like to publish it to my production server.
To do it I used _Publish_ function from context menu in Microsoft Visual Studio but during building I got an error like that:

command "node node_modules/webpack/bin/webpack.js --env.prod was exited by code 2

I tried to execute this command in _Developer Command Promt for VS 2017_ and i got errors:

  1. ERROR in [at-loader] ./ClientApp/routes.tsx:9:12
    TS2322: Type '{ exact: true; path: "/"; component: typeof Home; }' is no
    t assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> &
    Readonly<{ children?: ReactNode; }> & ...'.
    Type '{ exact: true; path: "/"; component: typeof Home; }' is not assignab
    le to type 'Readonly'.

  2. ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:67:21
    TS2694: Namespace 'React' has no exported member 'ComponentType'.

Visual Studio version is: Microsoft Visual Studio Enterprise 2017 version 15.2.

TypeScript version is 2.2.3.

I'm really new with TS and .net core apps. Is there any possibility to fix these errors?
Project which I want to publish is pure example generated by JavaScriptServices. I didn't add any changes.

The same problem occured when I generated _React redux_ example in _Developer Command Prompt for VS 2017_.

Thanks for help in advance!

Most helpful comment

It sounds like #1099 .
Could you update your package.json file to:

    ...
    "@types/react": "15.0.35",
    "@types/react-dom": "15.5.1",
    "@types/react-redux": "4.4.45",
    "@types/react-router-dom": "4.0.6",
    "@types/react-router-redux": "5.0.3",
    ...
    "typescript": "2.3.4",

and try it again? TS 2.2.3 sound like your template is a little bit older, so just in case please make a backup of your old package.json file.

All 4 comments

It sounds like #1099 .
Could you update your package.json file to:

    ...
    "@types/react": "15.0.35",
    "@types/react-dom": "15.5.1",
    "@types/react-redux": "4.4.45",
    "@types/react-router-dom": "4.0.6",
    "@types/react-router-redux": "5.0.3",
    ...
    "typescript": "2.3.4",

and try it again? TS 2.2.3 sound like your template is a little bit older, so just in case please make a backup of your old package.json file.

Yeah! Solved it! Publish is sucessfully completed.
Thanks for fast help.
I will try tomorrow if it works on deployment server.

Thanks for answering @stephtr!

Thanx @stephtr for the quick answer.

I am new to this react redux and dotnetcore envir so was really thought something I poked to make it failed!

Was this page helpful?
0 / 5 - 0 ratings