(更新解决方案)Express Web App服务抛出“ SyntaxError:意外令牌>”

时间:2018-07-29 03:01:55

标签: node.js azure express

我将同一Web应用程序部署到两个Azure应用程序服务,一个很好,而另一个则抛出这样的错误。我的网站基于Express,如何解决此问题?看起来错误不是来自我的源代码。

<html lang="en-US">
   <head>
      <title>Invitation Page</title>
      <link rel="stylesheet" type="text/css" href="css/main.css" />
   </head>
   <body>
      <header>
         <div class="top">
            <a class="logo" href="index.html">CapellaVolunteers<span 
               class="dotcom">.org</span></a>
         </div>
         <nav>
            <ul class="topnav">
               <li><a href="index.html">Home</a></li>
               <li><a href="invitation.html" class="active">Invitation</a></li>
               <li><a href="gallery.html">Gallery</a></li>
               <li><a href="registration.html">Registration</a></li>
            </ul>
         </nav>
      </header>
      <section id="pageForm">
         <label for="recipientName">Recipient name:</label>
         <input type="text" id="rname" name="recipientName" placeholder="Enter your Recipient Name" />
         <label for="organizationName">Organization name:</label>
         <input type="text" id="orgname" name="organizationName" placeholder="Enter your Organization Name" />
         <label for="eventDate">Event Date:</label>
         <input type="text" id="date" name="eventDate" placeholder="Enter your Event Date" />
         <label for="websiteURL">URL:</label>
         <input type="text" id="web" name="websiteURL" placeholder="Enter your Website URL" />
         <label for="hostName">Host name:</label>
         <input type="text" id="hname" name="hostName" placeholder="Host Name" />
         <input type="submit" id='showFormInput' value="Submit" />
      </section>
      <article id="placeholderContent">
         Hello
         <span id="recipientName">recipientName</span>!
         <br/>
         <br/> You have been invited to volunteer for an event held by
         <span id="organizationName">organizationName</span> on
         <span id="eventDate">eventDate</span>. Please come to the following 
         website:
         <span id="websiteURL">websiteURL</span> to sign up as a volunteer.
         <br/>
         <br/> Thanks!
         <br/>
         <br/>
         <span id="hostName">hostName</span>
      </article>
      <footer>This events site is for IT-FP3215 tasks.</footer>
   </body>
</html>

2 个答案:

答案 0 :(得分:1)

当我将WEBSITE_NODE_DEFAULT_VERSION设置为与Azure不兼容的版本时,遇到了这个问题。

它回退到不支持箭头功能的真正旧版本的节点。

您可以通过转到Azure控制台并执行node -v

对此进行验证。

答案 1 :(得分:0)

此问题最终得到解决,我们向MS发出了罚单,Microsoft将应用程序服务重新部署到了一组新服务器上。然后该网站正常工作。