Closed AbrarJahin closed 7 years ago
Hi, if I try to build a production environment, then I am finding this-
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Can u please have a look in it @MarkPieszak
I will take a look, could reproduce with the current master
branch as well. It still works from by fork (that is 21 commits behind now) so will check what has been changed.
@AbrarJahin if not specify the node version then the last version is used. See logs:
Downloading and installing node 6.9.5... Using default npm version: 3.10.10
Sure, thanks @ORuban
That Node version looks fine but something must of changed in the past 21 commits. One major thing that changed was the way webpack was setup (and the splitting of client/server bundles). I'm having trouble with Azure deploying currently as well, they must be coming from the same problem. Let me see if I can fix that, and hopefully it'll take care of both 👍 Sorry about that guys!
NP.
Thanks @MarkPieszak
Just chiming in to state that I am also experiencing errors with an Azure deployment.
Commenting to be notified.
If you guys want to get latest and give it a shot, it should work now! Tested with Azure and able to deploy there successfully now :) @riiight https://github.com/MarkPieszak/aspnetcore-angular2-universal/commit/bb7e2da5b96040acdfbfa4052547b4a22f0e173c
http://aspnetcore-angular2-universal.azurewebsites.net/
If it's still not working let me know we can re-open!
I have a project based on the seed that I tried unsuccessfully to deploy,, but before I try to debug that again, I thought I would try a deploy of the seed itself.
Here are the steps I've taken:
Unfortunately, he Publish failed at 97%. Here are the lines at the end of the error:
...95% [0] recording 95% [0] additional asset processing 96% [0] chunk asset optimization 97% [0] asset optimization 97% [0] emitting [0] npm WARN optional Skipping failed optional dependency /chokidar/fsevents: Angular2Spa
This is the same error I saw earlier with my own project. The temporary workaround I use for this is removing the following lines from \node_modules\chokidar\package.json:
"optionalDependencies": {
"fsevents": "^1.0.0"
},
There were also these warnings/errors which prevent it from successfully publishing:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : fallbackLoader option has been deprecated - replace with "fallback" C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : loader option has been deprecated - replace with "use" C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : loader option has been deprecated - replace with "use"
These were also errors I saw earlier with my own project. The temporary workaround I use for these is editing the following lines in webpack.config.vendor.js:
use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
and
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) }
After making these 3 change, the publish succeeds. When I try to view the site, however, I see this error:
An error occurred while starting the application. Exception: Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
This makes sense because there is no "node_modules" folder out on the Web App server (Is this because of the "exclude": [ "node_modules" ]
line in project.json? Maybe node_modules shouldn't be excluded?).
So then I go to a cmd prompt on the Web App (Kudu) and run "npm install". I then get this error:
npm WARN enoent ENOENT: no such file or directory, open 'D:\home\site\wwwroot\package.json'
So then I publish package.json from VS (right click on the file, select Publish), and then run "npm install" again. Doing this not only gets the packages, but also run a few other things as well (e.g. node install.js
, npm run webpack-vendor && npm run webpack
, etc. which also throw errors (see attached "NpmInstallOnServerErrors.txt").
I try to restart the Web App and viewing the site anyway and I see this error:
An error occurred while starting the application.
Exception: Call to Node module failed with error: Error: Cannot find module './tsconfig.json'
So, I figure I'll try publishing from VS again now that the node_modules are out on the server, but I get the same tsconfig.json error. I then try to publish tsconfig.json (right click, Publish in VS), restart the Web App, and then it the website finally loads.
So it works, but I had to do some setup gymnastics. If you're not seeing the same errors that I am, perhaps it has to do with the fact that:
Perhaps if you tried a Publish with a clean seed to a brand new Azure App Service, you'd experience the same issues that I experienced? Could you provide any information/pointers as to how I could make deploying to Azure a smoother process?
Any info you can provide is greatly appreciated. Thanks.
Hi @MarkPieszak
I am still having the issue.
Can u please have a look.
Thanks
@riiight Hey Don, so I'm publishing straight through the command line onto a brand new WebApp on Azure. When the app is create I select Deployment Options, then select Local Git Branch. Once that's done, go to Deployment Credentials, make sure you set your deployment credentials login/password.
Now go to Overview for the web app, ad you'll see Git Clone Url and copy it.
Now you can do:
git add .
git commit m - "whatever"
git remote add azure https://your-user-name@my-angular2-site.scm.azurewebsites.net:443/my-angular2-site.git
// ^ get this from Azure (Web App Overview section - Git clone url)
git push --set-upstream azure master
When doing this method it runs npm install, wel back etc (https://github.com/MarkPieszak/aspnetcore-angular2-universal/blob/bb7e2da5b96040acdfbfa4052547b4a22f0e173c/project.json#L70-77) not sure why kudu isn't?
I haven't tried using Kudu or VS publish, I (believe) you might need to be publishing from the resulting app out of dotnet publish with vs publish but I'm not sure! I'll have to experiment with that.
What version of this repo do you have at the moment? Check the package.json. The big change to fix azure deploy was moving almost all devDependencies to regular dependencies, and in the project.json removing Client from buildOptions exclude.
@AbrarJahin any reason why it couldn't compile aspnet? You have the latest rc.0 right?
Frankly speaking, I am new in Heroku.
So, I am not sure.
My work procedure is-
Go to here- https://dashboard.heroku.com/new?template=https://github.com/MarkPieszak/aspnetcore-angular2-universal.git
Then click on Deploy
Can u help please @MarkPieszak ?
I am using default options and I have a free account.
Do I need to configure anything or need a paid account?
There's definitely something strange going on with Heroku, I think we need to pass environment variables to it or something (?) I've used it in the past, but I'm no expert at it as well.
Moved Heroku issue to #100
Thanks @MarkPieszak
@MarkPieszak First off, thanks for the prompt reply. It is greatly appreciated.
I tried your method of deploying with git. Here's what happened:
An error occurred while starting the application. Exception: Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
An error occurred while starting the application. Exception: Call to Node module failed with error: Error: Cannot find module './tsconfig.json'
- So, I added the following line to the "scripts/prepublish" section in project.json (right before the "npm install" line):
"xcopy /y %publish:ProjectPath%\\tsconfig.json %publish:OutputPath%\\*",
- I ran "git push --set-upstream azure master" again and it was successful.
- This time, the Web site worked.
IMHO, the 2 changes I made should probably be applied to the seed or an equivalent fix should be added for future users who want to do a fresh publish of the seed to Azure.
Hi, I am new in using Heroku App.
I am not sure if I have done any wrong.
My work procedure is-
Go to here- https://dashboard.heroku.com/new?template=https://github.com/MarkPieszak/aspnetcore-angular2-universal.git
Then click on Deploy
Then getting this error-
app.json's project is not a valid Heroku application
More specifically-
Full log is shared here for better understanding-
Can you please help me to find if I am doing anything wrong @MarkPieszak .
Thanks in advance for helping.