I am following the steps to run the app and deploy to Azure but the deployment fails and I'd like to ask whether there's anything missing in the instructions.
I am able to compile and run the application for dev and aot builds.
I also added the remote azure and I run successfully dotnet publish.
Then I try to release my app to Azure:
git push in master
git push azure
the deployment begins but it fails to retrieve all the dependencies during npm install
See the errors:
$ git push azure
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 301 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id 'b3c5b3d06e'.
remote: Generating deployment script.
remote: Running deployment command...
remote: Handling ASP.NET Core Web Application deployment.
remote: ................
remote: Restoring packages for D:\home\site\repository\Amosya.csproj...
remote: ...
remote: Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\obj\project.assets.json
remote: Restore completed in 7.92 sec for D:\home\site\repository\Amosya.csproj.
remote:
remote: NuGet Config files used:
remote: D:\local\AppData\NuGet\NuGet.Config
remote:
remote: Feeds used:
remote: https://api.nuget.org/v3/index.json
remote: Microsoft (R) Build Engine version 15.1.1012.6693
remote: Copyright (C) Microsoft Corporation. All rights reserved.
remote:
remote: ..............
remote: Amosya -> D:\home\site\repository\bin\Release\netcoreapp1.1\Amosya.dll
remote: npm WARN package.json [email protected] No repository field.
remote: npm http GET https://registry.npmjs.org/angular2-template-loader
remote: npm http GET https://registry.npmjs.org/aspnet-prerendering
remote: npm http GET https://registry.npmjs.org/aspnet-webpack
remote: npm http GET https://registry.npmjs.org/awesome-typescript-loader
remote: npm http GET https://registry.npmjs.org/bootstrap
remote: npm http GET https://registry.npmjs.org/bootstrap-sass
remote: npm http GET https://registry.npmjs.org/core-js
remote: npm http GET https://registry.npmjs.org/css
remote: npm http GET https://registry.npmjs.org/css-loader
remote: npm http GET https://registry.npmjs.org/event-source-polyfill
remote: npm http GET https://registry.npmjs.org/expose-loader
remote: npm http GET https://registry.npmjs.org/extract-text-webpack-plugin
remote: npm http GET https://registry.npmjs.org/file-loader
remote: npm http GET https://registry.npmjs.org/html-loader
remote: npm http GET https://registry.npmjs.org/isomorphic-fetch
remote: npm http GET https://registry.npmjs.org/jquery
remote: npm http GET https://registry.npmjs.org/json-loader
remote: npm http GET https://registry.npmjs.org/ng2-signalr
remote: npm http GET https://registry.npmjs.org/ngx-bootstrap
remote: npm http GET https://registry.npmjs.org/node-sass
remote: npm http GET https://registry.npmjs.org/preboot
remote: npm http GET https://registry.npmjs.org/raw-loader
remote: npm http GET https://registry.npmjs.org/rimraf
remote: npm http GET https://registry.npmjs.org/rxjs
remote: npm http GET https://registry.npmjs.org/sass-loader
remote: npm http GET https://registry.npmjs.org/signalr
remote: npm http GET https://registry.npmjs.org/style-loader
remote: npm http GET https://registry.npmjs.org/to-string-loader
remote: npm http GET https://registry.npmjs.org/typescript
remote: npm http GET https://registry.npmjs.org/url-loader
remote: npm http GET https://registry.npmjs.org/webpack
remote: npm http GET https://registry.npmjs.org/webpack-hot-middleware
remote: npm http GET https://registry.npmjs.org/webpack-merge
remote: npm http GET https://registry.npmjs.org/zone.js
remote: npm http GET https://registry.npmjs.org/chai
remote: npm http GET https://registry.npmjs.org/codelyzer
remote: npm http GET https://registry.npmjs.org/jasmine-core
remote: npm http GET https://registry.npmjs.org/jest
remote: npm http GET https://registry.npmjs.org/jest-preset-angular
remote:
remote: npm http GET https://registry.npmjs.org/angular/animations
remote: npm http GET https://registry.npmjs.org/angular/common
remote: npm http GET https://registry.npmjs.org/angular/compiler
remote: npm http GET https://registry.npmjs.org/angular/compiler-cli
remote: npm http GET https://registry.npmjs.org/angular/core
remote: npm http GET https://registry.npmjs.org/angular/forms
remote: npm http GET https://registry.npmjs.org/angular/http
remote: npm http GET https://registry.npmjs.org/angular/platform-browser
remote: npm http GET https://registry.npmjs.org/angular/platform-browser-dynamic
remote: npm http GET https://registry.npmjs.org/angular/platform-server
remote: npm http GET https://registry.npmjs.org/angular/router
remote: npm http GET https://registry.npmjs.org/ngx-translate/core
remote: npm http GET https://registry.npmjs.org/ngx-translate/http-loader
remote: npm http GET https://registry.npmjs.org/types/node
remote: npm http GET https://registry.npmjs.org/ngtools/webpack
remote: npm http GET https://registry.npmjs.org/types/chai
remote: npm http GET https://registry.npmjs.org/types/jasmine
remote: npm http GET https://registry.npmjs.org/types/jest
remote: npm http 304 https://registry.npmjs.org/bootstrap
remote: npm http 304 https://registry.npmjs.org/awesome-typescript-loader
remote: npm http 304 https://registry.npmjs.org/angular2-template-loader
remote: npm http 304 https://registry.npmjs.org/core-js
remote: npm http 304 https://registry.npmjs.org/css
remote: npm http 304 https://registry.npmjs.org/bootstrap-sass
remote: npm http 304 https://registry.npmjs.org/expose-loader
remote: npm http 304 https://registry.npmjs.org/event-source-polyfill
remote: npm http 304 https://registry.npmjs.org/aspnet-prerendering
remote: npm http 304 https://registry.npmjs.org/extract-text-webpack-plugin
remote: npm http 304 https://registry.npmjs.org/aspnet-webpack
remote: npm http 304 https://registry.npmjs.org/isomorphic-fetch
remote: npm http 304 https://registry.npmjs.org/html-loader
remote: npm http 304 https://registry.npmjs.org/jquery
remote: npm http 304 https://registry.npmjs.org/file-loader
remote: npm http 304 https://registry.npmjs.org/json-loader
remote: npm http 304 https://registry.npmjs.org/css-loader
remote: npm http 304 https://registry.npmjs.org/ng2-signalr
remote: npm http 304 https://registry.npmjs.org/ngx-bootstrap
remote: npm http 304 https://registry.npmjs.org/node-sass
remote: npm http 304 https://registry.npmjs.org/preboot
remote: npm http 304 https://registry.npmjs.org/rimraf
remote: npm http 304 https://registry.npmjs.org/rxjs
remote: npm http 304 https://registry.npmjs.org/raw-loader
remote: npm http 304 https://registry.npmjs.org/signalr
remote: npm http 304 https://registry.npmjs.org/typescript
remote: npm http 304 https://registry.npmjs.org/sass-loader
remote: npm http 304 https://registry.npmjs.org/style-loader
remote: npm http 304 https://registry.npmjs.org/to-string-loader
remote: npm http 304 https://registry.npmjs.org/url-loader
remote: npm http 304 https://registry.npmjs.org/webpack
remote: npm http 304 https://registry.npmjs.org/webpack-hot-middleware
remote: npm http 304 https://registry.npmjs.org/webpack-merge
remote: npm http 304 https://registry.npmjs.org/zone.js
remote: npm http 304 https://registry.npmjs.org/chai
remote: npm http 304 https://registry.npmjs.org/codelyzer
remote: npm http 304 https://registry.npmjs.org/jasmine-core
remote: npm http 304 https://registry.npmjs.org/jest
remote: npm http 304 https://registry.npmjs.org/jest-preset-angular
remote: npm http 404 https://registry.npmjs.org/angular/common
remote: npm http 404 https://registry.npmjs.org/angular/compiler-cli
remote: npm http 404 https://registry.npmjs.org/angular/animations
remote: npm http 404 https://registry.npmjs.org/angular/compiler
remote: npm http 404 https://registry.npmjs.org/angular/core
remote: npm ERR! 404 Not Found
remote: npm ERR! 404
remote: npm ERR! 404 'angular/common' is not in the npm registry.
remote: npm ERR! 404 You should bug the author to publish it
remote: npm ERR! 404 It was specified as a dependency of 'amosya'
remote: npm ERR! 404
remote: npm ERR! 404 Note that you can also install from a
remote: npm ERR! 404 tarball, folder, or http url, or git url.
remote:
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install"
remote: npm ERR! cwd D:\home\site\repository
remote: npm ERR! node -v v0.10.28
remote: npm ERR! npm -v 1.4.9
remote: npm ERR! code E404
remote: npm http 404 https://registry.npmjs.org/angular/http
remote: npm http 404 https://registry.npmjs.org/angular/forms
remote: npm http 404 https://registry.npmjs.org/angular/platform-browser
remote: npm http 404 https://registry.npmjs.org/angular/platform-browser-dynamic
remote: npm http 404 https://registry.npmjs.org/angular/router
remote: npm http 404 https://registry.npmjs.org/angular/platform-server
remote: npm http 404 https://registry.npmjs.org/ngx-translate/http-loader
remote: npm http 404 https://registry.npmjs.org/types/node
remote: npm http 404 https://registry.npmjs.org/ngx-translate/core
remote: npm http 404 https://registry.npmjs.org/ngtools/webpack
remote: npm http 404 https://registry.npmjs.org/types/chai
remote: npm http 404 https://registry.npmjs.org/types/jasmine
remote: npm http 404 https://registry.npmjs.org/types/jest
remote: D:\home\site\repository\Amosya.csproj(34,5): error MSB3073: The command "npm install" exited with code 1.
remote: Failed exitCode=1, command=dotnet publish "D:\home\site\repository\Amosya.csproj" --output "D:\local\Temp\8d4cc69c6c3aaa8" --configuration Release
remote: An error has occurred during web site deployment.
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://amosya.scm.azurewebsites.net/amosya.git
d302c6c..b3c5b3d master -> master
I have tried adding
"engines": {
"node": "8.0.0"
}
to the package.json to specify what node version to use. It does not make any difference, it always fails to deploy. I've also tried with node version 8.1.4 and specifying a npm engine version. Locally I am using node v8.1.4 and npm 5.0.3.
Sometimes it's angular/common which fails, some other times is angular/animations.
Any help would be much appreciated. Also it would be great to describe a bit more the deployment process as I cannot find out what am I missing :) .
Thank you
Hey there! Did you make sure that azure is running a later version of Node? Use the latest versions, it looks like it was installing with 0.10.x. Let me know
Thanks for the quick reply. I think you're right, it seems Azure is using a different version of node and npm. I thought the way to specify which node and npm version to use in Azure was to specify the "engines" in package.json as per https://docs.microsoft.com/en-us/azure/nodejs-specify-node-version-azure-apps but it doesn't seem to make any difference. I'll continue investigating and update if I resolve it
Go into azure you'll see settings for your App pool, and you can manually change the version number there.
Engines is for when your package is a library, to throw errors when someone tries to npm install it somewhere.
Sounds good!
Thank you very much.
I solved the issue as you suggested by configuring my App Service in Azure.
my app> Application Settings > App Settings
I added the following key-value pair:
key: WEBSITE_NODE_DEFAULT_VERSION value: 8.1.4
More info here
For anyone else running into this issue, you can find what runtime versions of node are installed on the app service server by going (in Azure) to (Your App Service App) > Development Tools > Advanced Tools > Runtime versions.
Once you know the latest node runtime, you can set the WEBSITE_NODE_DEFAULT_VERSION setting in Application Settings >App Settings`
Most helpful comment
For anyone else running into this issue, you can find what runtime versions of node are installed on the app service server by going (in Azure) to (Your App Service App) >
Development Tools>Advanced Tools>Runtime versions.Once you know the latest node runtime, you can set the
WEBSITE_NODE_DEFAULT_VERSIONsetting inApplication Settings >App Settings`