locked
Node (TS) + Angular 6 deployment - Won't build because the Angular CLI detects the default Node version. RRS feed

  • Question

  • Just want to report this weird behavior (or its just me :)).

    Package.json is set to node 8.11.1.

    Changing the default version fixes this.

    Command: "D:\home\site\deployments\tools\deploy.cmd"
    Handling node.js deployment.
    KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
    Start script "./dist/server/server.js" from package.json is not found.
    Looking for app.js/server.js under site root.
    Missing server.js/app.js files, web.config is not generated
    Node.js versions available on the platform are: 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.10.40, 0.12.0, 0.12.2, 0.12.3, 0.12.6, 4.0.0, 4.1.0, 4.1.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3.0, 4.3.2, 4.4.0, 4.4.1, 4.4.6, 4.4.7, 4.5.0, 4.6.0, 4.6.1, 4.8.4, 5.0.0, 5.1.1, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.1, 6.0.0, 6.1.0, 6.2.2, 6.3.0, 6.5.0, 6.6.0, 6.7.0, 6.9.0, 6.9.1, 6.9.2, 6.9.4, 6.9.5, 6.10.0, 6.10.3, 6.11.1, 6.11.2, 6.11.5, 6.12.2, 6.12.3, 7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.7.0, 7.7.4, 7.10.0, 7.10.1, 8.0.0, 8.1.4, 8.4.0, 8.5.0, 8.7.0, 8.8.0, 8.8.1, 8.9.0, 8.9.3, 8.9.4, 8.10.0, 8.11.1, 10.0.0.
    Selected node.js version 8.11.1. Use package.json file to choose a different version.
    Selected npm version 5.6.0
    Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml
    npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'
    npm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\6.9.1\node.exe but npm is using D:\Program Files (x86)\nodejs\8.11.1\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
    
    > web-app-mean-template@0.0.0 install D:\home\site\wwwroot
    > tsc -p ./src/server/tsconfig.server.json | ng build --aot --prod
    
    You are running version v6.9.1 of Node.js, which is not supported by Angular CLI v6.
    The official Node.js version that is supported is 8.9 and greater.
    
    Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 3
    npm ERR! web-app-mean-template@0.0.0 install: `tsc -p ./src/server/tsconfig.server.json | ng build --aot --prod`
    npm ERR! Exit status 3
    npm ERR! 
    npm ERR! Failed at the web-app-mean-template@0.0.0 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     D:\local\AppData\npm-cache\_logs\2018-05-22T11_43_59_995Z-debug.log
    Failed exitCode=3, command="D:\Program Files (x86)\nodejs\8.11.1\node.exe" "D:\Program Files (x86)\npm\5.6.0\node_modules\npm\bin\npm-cli.js" install --production
    An error has occurred during web site deployment.
    Missing server.js/app.js files, web.config is not generated\r\nnpm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'\r\nnpm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\6.9.1\node.exe but npm is using D:\Program Files (x86)\nodejs\8.11.1\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.\r\nYou are running version v6.9.1 of Node.js, which is not supported by Angular CLI v6.\r\nThe official Node.js version that is supported is 8.9 and greater.\r\n\r\nPlease visit https://nodejs.org/en/ to find instructions on how to update Node.js.\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 3\r\nnpm ERR! web-app-mean-template@0.0.0 install: `tsc -p ./src/server/tsconfig.server.json | ng build --aot --prod`\r\nnpm ERR! Exit status 3\r\nnpm ERR! \r\nnpm ERR! Failed at the web-app-mean-template@0.0.0 install script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     D:\local\AppData\npm-cache\_logs\2018-05-22T11_43_59_995Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\73.10510.3399\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
    

    Tuesday, May 22, 2018 12:16 PM

All replies

  • Check the current Node.js version running on the web app using node -v or node --version command through Kudu Console.

    To check the available runtime versions for your app, Go to Kudu console -> Runtime versions

    The Node.js versions provided by Azure are constantly updated. Unless otherwise specified, the default version that is specified in the WEBSITE_NODE_DEFAULT_VERSION environment variable will be used.

    In case if you haven’t done, specify the WEBSITE_NODE_DEFAULT_VERSION as 8.11.1 under ‘Application settings’ and check if that resolves the issue.

    Reference: NodeJs and NPM versions on Azure App Services

    ------------------------------------------------------------------------------------------
    If this answer was helpful, click “Mark as Answer” or “Up-Vote”. To provide additional feedback on your forum experience, click here.

    Tuesday, May 22, 2018 6:58 PM
  • Hey Ashok,

    Thank for your reply. I immediately did that and it runs fine ofcoarse. Just wanted to let you guys know that this happens when you build an app with NPM like this:

    {
      "name": "something",
      "version": "0.0.0",
      "main": "./dist/server/server.js",
      "license": "MIT",
      "scripts": {
        "ng": "ng",
        "install": "tsc -p ./src/server/tsconfig.server.json | ng build --aot --prod",
        "start": "node ./dist/server/server.js",
        "build": "tsc -p ./src/server/tsconfig.server.json | ng build --aot"    
      },
      "private": true,
      "dependencies": {
        "@angular-devkit/build-angular": "~0.6.3",
        "@angular/animations": "6.0.2",
        "@angular/cdk": "^6.1.0",
        "typescript": "2.7.2",
        etc... 
      },
      "engines": {
        "node": ">8.11.0 <10.0.0",
        "npm": ">=5.6.0"
      }
    }

    It doesn't set node (as logged) to the correct version and everything seems out of order.

    Tuesday, May 22, 2018 7:14 PM
  • Thanks for sharing the code snippet/feedback. We will look into it.

    Wednesday, May 23, 2018 8:13 PM
  • Still getting this error, for some reason by default in application settings it was set to version 6.9.1. 
    Thursday, October 18, 2018 3:55 PM