Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Upgrading to version 2.0.1 fails #1069

Closed
shaunrfield opened this issue Jun 27, 2017 · 8 comments
Closed

Upgrading to version 2.0.1 fails #1069

shaunrfield opened this issue Jun 27, 2017 · 8 comments

Comments

@shaunrfield
Copy link

We have this package include as a devDependencies. Whilst it doesn't cause npm install to fail the error in the output causes our dotnet build break. You can easily replicate the issue by running the install just for this package -

Command
npm install [email protected]

Output

> [email protected] postinstall D:\Development\PromappApi\PromappApiClient\node_modules\aspnet-webpack-react
> node scripts/postinstall.js

{ Error: Found '{' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace) at line 1,1 >>>{
  "compileOnSave" ...
    at error (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson-parse.js:40:11)
    at keyname (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson-parse.js:158:9)
    at object (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson-parse.js:356:15)
    at rootValue (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson-parse.js:426:28)
    at module.exports (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson-parse.js:444:10)
    at Object.parse (D:\Development\PromappApi\PromappApiClient\node_modules\hjson\lib\hjson.js:161:14)
    at ensureTsConfigContainsTypesEntry (D:\Development\PromappApi\PromappApiClient\node_modules\aspnet-webpack-react\scripts\postinstall.js:31:39)
    at Object.<anonymous> (D:\Development\PromappApi\PromappApiClient\node_modules\aspnet-webpack-react\scripts\postinstall.js:51:5)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10) hint: '' }
[email protected] D:\Development\PromappApi\PromappApiClient
`-- [email protected]  invalid
  +-- @types/[email protected]
  | +-- @types/[email protected]
  | +-- @types/[email protected]
  | `-- @types/[email protected]
  |   `-- @types/[email protected]
  `-- [email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] No repository field.
@wenkangjing
Copy link

I followed this walk around and it worked. SteveSandersonMS' reply issue 1066

To get this workaround in an existing project, just reinstall all your NPM dependencies. For example, delete your project's node_modules directory completely, then run npm install. New projects should get it automatically. You might have to clear your NPM cache first if that still isn't getting the new aspnet-webpack-react version 2.0.1.

  • deleted node_modules folder
  • npm cache clean --force
  • dotnet restore and dotnet build
  • npm install
  • webpack

@ruskindantra
Copy link

The above mentioned work around doesn't work, it all works the first time after doing that. As soon you clean your project, i.e. delete node_modules, bin and obj directories and then do a dotnet build again it fails. Note that the webpack command is run as part of our csproj BeforeBuild target.

@wenkangjing
Copy link

wenkangjing commented Jun 27, 2017

I didn't explicitly install aspnet-webpack-react to my project, it should automatically link via SpaServices. Restore or delete/readd NuGet packages worked for me.

@SteveSandersonMS
Copy link
Member

@shaunrfield @ruskindantra Do you work together? Just trying to understand whether this is failing in one specific project, or in two completely unrelated projects built by teams that have never met before!

Based on the stack trace, it sounds like your tsconfig.json file is invalid. The stack trace is saying it found that file, but can't parse it. Would you be able to verify that the file is correctly-formed JSON (optionally with comments)? If you believe it is correctly formed, can you paste a copy of it here for me to try to reproduce the issue?

@ruskindantra
Copy link

@SteveSandersonMS yes we are working on the same project. See below our tsconfig.json, it hasn't changed since the new release of aspnet-webpack-react.

{
  "compileOnSave": true,
  "compilerOptions": {
    "outDir": "./wwwroot/dist/",
    "sourceMap": true,
    "noImplicitAny": false,
    "module": "commonjs",
    "target": "es5",
    "jsx": "react",
    "typeRoots": [ "./node_modules/@types/*", "./node_modules/*" ]
  },
  "include": [
    "./Views/**/Components/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Jun 28, 2017

Thanks for posting the tsconfig.json contents. I'm afraid I've not been able to reproduce the issue - your tsconfig.json file looks fine, and I don't get any error when I install [email protected].

Can you provide more detailed repro steps, starting from a new project?

BTW, if you prefer not to spend your time on this, you could just change your aspnet-webpack-react version to 2.0.0 exactly, and not upgrade to 2.0.1. The 2.0.1 patch is just to work around an issue with TypeScript typings on mismatching versions of @types/react-router and @types/react, which won't affect you if you either don't update your @types dependencies, or if you update all of them. Future updates to aspnet-webpack-react are going to have a 3.x version number. You could update to aspnet-webpack-react@^3.0.0-beta now if you want, and then you also won't have this issue.

@SteveSandersonMS
Copy link
Member

Since we don't have any more information about how to reproduce this, and nobody else is reporting anything similar, I'll close this as not being a general bug but rather something specific to your project. If you do find repro steps in the future, please re-open or file a new issue. Hope that's OK!

@villasante
Copy link

villasante commented Jul 19, 2017

I had the same issue. This issue was only reproing for me in my VSTS build agent that has a node version 6.10.3.
Setting [email protected] did the trick.

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

No branches or pull requests

5 participants