Skip to main content
 首页 » 编程设计

angularjs之'错误:[$ parse:lexerr]词法分析器错误:意外的下一个字符'在heroku部署上

2024年09月07日52powertoolsteam

我使用yeoman生成器编写了一个 Angular 应用程序。它在开发中效果很好,但是部署到heroku并访问特定页面后,出现此错误:

Error: [$parse:lexerr] Lexer Error: Unexpected next character  at columns 0-0 [\] in expression [\]. 
http://errors.angularjs.org/1.2.6/$parse/lexerr?p0=Unexpected%20nextharacter%20&p1=s%200-0%20%5B%5C%5D&p2=%5C 
    at http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:3:30474 
    at Zd.throwError (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:6:14396) 
    at Zd.lex (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:6:13696) 
    at $d.parse (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:6:16445) 
    at http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:5:13197 
    at e.parseAs (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:5:23401) 
    at Object.e.(anonymous function) [as parseAsResourceUrl] (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:5:23604) 
    at http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:6:28873 
    at q (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:4:23046) 
    at h (http://ang-news.herokuapp.com/scripts/244c37f5.vendor.js:4:19250)  

This description说当表达式有词法错误时发生错误。

那是什么,为什么它只出现在生产中?

请您参考如下方法:

我遇到一些错误
用过的 ng-click

<a ng-click="#/search/San+Francisco">test</a> 

代替 ng-href
<a ng-href="#/search/San+Francisco">test</a> 

希望对您有所帮助