Node js deployment "SyntaxError: Unexpected token ..."


  • So I followed this guide and created a working web app in my resource group.

    I am also able to hook up my VSTS git to this Web app for continuous integration.

    In my local IIS, I am able to run nodejs app no issue, with iisnode installed. The CI I have setup on azure deploys exactly the same files on Azure.

    After deploying, I am getting this from the ftp://<app>/LogFiles/Application/logging-errors.txt

    SyntaxError: Unexpected token ...
        at exports.runInThisContext (vm.js:53:16)
        at Module._compile (module.js:373:25)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (D:\home\site\wwwroot\build\mphwebserver.js:6:25)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)

    The only difference is that locally I run node 9.2, and that Azure only has 8.3 installed.

    Any ideas?

    Tuesday, January 9, 2018 9:34 PM

All replies

  • Since there is no exact error message, it is difficult to debug what went wrong here.

    I would suggest you refer Enabling Azure Diagnostics in Azure Cloud Services and Enable remote debugging when using continuous delivery to publish to Azure for getting to the root cause of this issue.

    Do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Wednesday, January 10, 2018 2:49 PM
  • Neither of those resources you are linking to are relevant for using azure-pipelines.yml for build and the release pipeline for deployment. It's publishing as a package and there's nothing you can do through kudu to debug this live and the only thing differing is the "Unexpected token.." error that is not reproducible locally even if you download the deployed package, unzip it and run it. It's something in the whole "run as a package" feature for NodeJS and there's no remote debugging that today.
    Monday, March 25, 2019 10:31 AM