jenmcquade / aspnetcore-react-redux

Boilerplate for C# ASP .NET Core MVC SPA with TypeScript, React and Redux
15 stars 5 forks source link

Visual Studio Build errors #9

Open codeprod opened 6 years ago

codeprod commented 6 years ago

Hi Jon,

Firstly,this looks a really good project, big thank you (I am using it as a boilerplate to learn from) However, I am struggling to get it to build either in VS Community 2017 Preview (V15.7.0 Preview 2.0) on Windows 10 (latest build) with .Net Core 2.1, NPM 5.60, Node v8.11.1, Webpack 4.5.0, TypeScript 2.8 or via docker (Prod or Dev)

I appreciate that you have posted this up on GitHub and I feel like I should be able to work it out but I am struggling a bit.

NPM errors via Windows Powershell

PS C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src> npm install
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies your
self.
npm WARN aspnet-webpack@2.0.3 requires a peer of webpack@^1.13.2 || ^2.1.0-beta || ^3.0.0 but none is installed. You mus
t install peer dependencies yourself.
npm WARN aspnet-webpack-react@3.0.0 requires a peer of webpack@^2.2.0 but none is installed. You must install peer depen
dencies yourself.
npm WARN eslint-config-react-app@2.1.0 requires a peer of babel-eslint@^7.2.3 but none is installed. You must install pe
er dependencies yourself.
npm WARN eslint-config-react-app@2.1.0 requires a peer of eslint-plugin-jsx-a11y@^5.1.1 but none is installed. You must
install peer dependencies yourself.
npm WARN react-time@4.3.0 requires a peer of react@>=0.13.0 <16.0.0 but none is installed. You must install peer depende
ncies yourself.
npm WARN react-time@4.3.0 requires a peer of moment@^2.8.3 but none is installed. You must install peer dependencies you
rself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You
must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any
"} (current: {"os":"win32","arch":"x64"})

up to date in 12.053s

Not sure if these are just warnings but the npm folder does not load in VS 2017 Preview (yellow triangle) and I get the following build errors.

VS 2017 Preview build errors

Severity    Code    Description Project File    Line    Suppression State
Error   CS7064  Error opening icon file C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src\wwwroot\favicon.ico -- Could not find file 'C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src\wwwroot\favicon.ico'. flightsearch    C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src\CSC  1   Active

Severity    Code    Description Project File    Line    Suppression State
Error   TS5055  Cannot write file 'C:/Users/James/Documents/Visual Studio 2017/Projects/Preview/aspnetcore-react-redux-master/src/ClientApp/registerServiceWorker.js' because it would overwrite input file.    C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src (tsconfig or jsconfig project)       1   Active

Severity    Code    Description Project File    Line    Suppression State
Error   TS5055  Cannot write file 'C:/Users/James/Documents/Visual Studio 2017/Projects/Preview/aspnetcore-react-redux-master/src/webpack.config.js' because it would overwrite input file. C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src (tsconfig or jsconfig project)       1   Active

Severity    Code    Description Project File    Line    Suppression State
Error   TS5055  Cannot write file 'C:/Users/James/Documents/Visual Studio 2017/Projects/Preview/aspnetcore-react-redux-master/src/webpack.config.vendor.js' because it would overwrite input file.  C:\Users\James\Documents\Visual Studio 2017\Projects\Preview\aspnetcore-react-redux-master\src (tsconfig or jsconfig project)       1   Active

btw Tacoma (and the whole pacfic nw) looks a great place - on my list of places to visit!

Cheers and Thanks again for a great project

James

codeprod commented 6 years ago

The favicon error was due to a setting in the properties > Application > Resource > Icon and Manifest, I swapped to the Default Icon. I am still looking at the others ! cheers James

jenmcquade commented 6 years ago

@jimbobster Thanks so much for alerting me, and I appreciate the kindness! I'll try my best to address these in the next week. I've mostly been using Docker builds without VIsual Studio integration lately, so it's time now to ensure it works with or without it.

Warnings The NPM warnings are ones I get as well. Some node modules output a warning when they aren't aware there's a new version of a dependency that's available, even if that newer version has been tested for compatibility. As it hasn't stopped my development and use in my own lesson planning, I've just ignored them for now.

Missing Project Dependencies The .ico is a miss somewhere for me in the commits, so I'll have a look at that soon. I haven't had the opportunity yet to start a fresh installation of everything to ensure it's fully community-ready yet. Having a public repo has been the best way for my own students to quickly grab where we were at when we started together. Now, I need to concentrate on bringing everyone else in.

You should expect a comment that addresses these issues by end of Monday, 4/9.

Cheers! Jon

codeprod commented 6 years ago

@jonmcquade Thanks Jon, it is a really good project and thank you for your help ! Have a great weekend Cheers James

jenmcquade commented 6 years ago

@jimbobster thanks for your patience. I made some commits to master over the weekend, to resolve icon loading issues.

Automated builds are being pushed here: https://dotnetcore-flightsearch.herokuapp.com/

I haven't come across the overwrite errors like the one below, but am curious if this might be an issue with downloading and extracting as a zip, vs a git clone url method? Not sure, but you might try that in a new directory, on a new clone with weekend updates. It might be a Windows folder permissions issue, since there are executables in the zip.

Cannot write file 'C:/Users/James/Documents/Visual Studio 2017/Projects/Preview/aspnetcore-react-redux-master/src/ClientApp/registerServiceWorker.js' because it would overwrite input file.

Over the weekend, I did a fresh install of an environment using a little Acer 10 Windows 10 tablet. It was slow, but I was able to do the following to get it to work:

  1. Installed NPM 8.11 and Webpack 4 (with Webpack cli as an additional npm install) globally. Installed GitHub's terminal for cloning the repo.
  2. Installed VS 2017 Preview. Tried to run dotnet restore in the .src folder, but it failed, saying it couldn't use current SDK version for building. So, README was wrong and is updated ... you do still need to install the SDK apart from VS Preview, but VS Preview is needed in order to change/target .NET Core 2.1 apps. I've updated the link to download the SDK for all OS types. You don't need to install the Runtime, as it's bundled with the installation.
  3. After installing the SDK, I ran dotnet restore which was successful. Then I ran npm install and both webpack --mode development --config webpack.config.vendor.js and webpack --mode development. This helped me diagnose why the icon file wasn't being properly loaded, and I created a Webpack entrypoint for it to be added to the src/www/dist folder using the file-loader module.
  4. I started a debug session inside VS Preview and the SDK version errors went away. I was able to load the test app inside of my browser at http://localhost:5000.

Note ... I did not have time to install and test Docker on the fresh environment. I'll get to that before Wednesday. If you do try using Docker, please make sure it's using Linux containers instead of Windows containers, inside its context menu.

Please let me know in as much detail as you think is needed, if you run into the existing issues you saw. If you see something new, I'd appreciate a new issue be created so I can close this one.

Thanks for contributing! Take care. Jon

codeprod commented 6 years ago

@jonmcquade - Thanks for the detailed comment Jon - great stuff, I will run through the steps and come back tomorrow 4/11 with any comments! Cheers James

codeprod commented 6 years ago

Hi Jon (@jonmcquade),

Appreciate that this on the bleeding edge (which is very cool!) - with beta versions that maybe causing the issues. However, apologies if I am causing the probs.

By hand

Dotnet restore works Npm install works. Afraid I cannot rub webpack globally (other projects are on older versions of webpack) As an aside, running webpack via Powershell locally is difficult (the term 'webpack' is not recognized as the name of a cmdlet, function, script file) I think the preferred approach, is to include the webpack commands in the package.json file?

"scripts": {
    "start": "webpack --config webpack.config.js"
}

Be good to hear you thoughts.

VS Preview (15.30)

Error message on load (tried on 2 pc's) See image. vserror

I think this is a problem with the latest VS build, as it didnt appear on the previous VS version (serves me right for updating)

Docker

ERROR: for aspnetcore-react-redux-dev  Cannot start service flightsearch: driver failed programming external connectivit
y on endpoint aspnetcore-react-redux-dev (9320aad8219f28db508933ad138198d44539d235662b2cf550c2d81dacc9f586): Error start
ing userland proxy: mkdir /port/tcp:0.0.0.0:8443:tcp:172.19.0.2:3001: input/output error

ERROR: for flightsearch  Cannot start service flightsearch: driver failed programming external connectivity on endpoint
aspnetcore-react-redux-dev (9320aad8219f28db508933ad138198d44539d235662b2cf550c2d81dacc9f586): Error starting userland p
roxy: mkdir /port/tcp:0.0.0.0:8443:tcp:172.19.0.2:3001: input/output error
ERROR: Encountered errors while bringing up the project.

But the online version looks awesome :)

Cheers

James

codeprod commented 6 years ago

btw I am more than happy to help in anyway ! Thanks again Cheers J

codeprod commented 6 years ago

Hi Jon (@jonmcquade) - Sent you a PM on your gmail. Just in case it goes straight to spam ;)

jenmcquade commented 6 years ago

@jimbobster I'm just now coming back around to this, thanks for the help. I was waiting on some dev hardware so I could start testing in Debian natively and use this repo to bootstrap my portfolio site.

There are definitely things I can do to help ensure that webpack is run locally to the project, though the .csproj does some of that logic for prod builds. I spent a lot of time towards the end of March inside of Docker, and that led to some assumptions of how much control JS dependencies could have on the file system.

Anyways, there's a new security vulnerability in a Node dependency, so I'm back in project.json and will have a look at the best means to resolve. Would love to hear from you soon, if you're interested in validating!

Cheers