小编Ale*_*dro的帖子

语法错误:意外的标记;编译ejs时

我正在尝试在我的 Express 应用程序中使用此谷歌地图代码,但它给了我一个语法错误。我已经过滤了这个函数的错误:

  <% var map; %>
  <% function initMap() { %>
  <%  map = new google.maps.Map(document.getElementById('map'), { %>
  <%    center: {lat: -34.397, lng: 150.644}, %>
  <%    zoom: 8 %>
  <%  }); %>
  <% }; %>
Run Code Online (Sandbox Code Playgroud)

错误消息并没有多大帮助:

SyntaxError: Unexpected token ; in C:\proyectos\google-location-api\views\resultados.ejs while compiling ejs

If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
    at Object.compile (C:\proyectos\google-location-api\node_modules\ejs\lib\ejs.js:524:12)
    at Object.compile (C:\proyectos\google-location-api\node_modules\ejs\lib\ejs.js:338:16)
    at handleCache (C:\proyectos\google-location-api\node_modules\ejs\lib\ejs.js:181:18)
    at tryHandleCache (C:\proyectos\google-location-api\node_modules\ejs\lib\ejs.js:203:14)
    at View.exports.renderFile [as engine] (C:\proyectos\google-location-api\node_modules\ejs\lib\ejs.js:412:10)
    at View.render (C:\proyectos\google-location-api\node_modules\express\lib\view.js:128:8) …
Run Code Online (Sandbox Code Playgroud)

ejs node.js express

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

ejs ×1

express ×1

node.js ×1