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

Two issues on Windows - reflect-metadata missing and client app crash #185

Closed
BSalita opened this issue Jul 15, 2016 · 4 comments
Closed

Comments

@BSalita
Copy link

BSalita commented Jul 15, 2016

There's two issues with windows.

  1. webpack complained that it couldn't find reflect-metadata. I removed the import of reflect-metadata and then webpack completed without errors. I have no idea if this is correct fix.

  2. The counter's increment button isn't working. Turns out the issue is that precache from server is displaying pages, gives illusion of working, but client app crashes. This can be proven if you remove precache from tag and run. "Loading..." appears but the webpages are never shown. I have no idea what's broken. Maybe related to first issue?

Works fine using Ubuntu 16.04.

@BradRem
Copy link

BradRem commented Jul 15, 2016

I was having both these issues, but after I added "reflect-metadata" to the "dependencies" under package.json, both issues were resolved.

@tsmith-sdm
Copy link

Adding the import 'reflect-metadata' to boot-client.ts resolved the issue for me but only when compiling and running from VS2015. If I pop out to a cmd prompt and run > dotnet run I still get the following error. This is also what breaks the counter page.

Error: Cannot find module "reflect-metadata"
/dist/main.js?v=NRyF4xz17BbBUvE2kfFqr5de-qY0BPjRSvLL1hWLrAk:1

boot-client.ts:

require('zone.js');
import 'bootstrap';
import 'reflect-metadata';
import './styles/site.css';

@justinhixson
Copy link

@tsmith-sdm I presume you meant adding the "reflect-metadata" to the "dependencies" under package.json, as @BradRem suggested? My boot-client.ts was correct out of the box, and I didn't need to add anything to it. I did have to do what @BradRem suggested, and as you stated, it only works when run from Visual Studio, and continues to fail when run from the command line.

@SteveSandersonMS
Copy link
Member

I'm pretty sure this is the same as #239 (and also mentioned in #82). reflect-metadata doesn't get installed properly on Windows if you're on NPM 2.x. You need NPM 3.x (as per docs).

Note that just having installed NPM 3.x on your Windows machine doesn't mean that Visual Studio will use it, since VS has its own private copy of Node/NPM that it uses. Getting VS to use NPM 3.x is a bit more involved - see the "A FIX" heading on http://www.hanselman.com/blog/VisualStudio2015FixingDependenciesNpmNotInstalledFromFseventsWithNodeOnWindows.aspx

If anyone's definitely on NPM 3.x (both when running from command line, and from VS, which has to be set up differently) and still gets this, please re-open!

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