未捕获的语法错误:在严格模式下code,功能只能在顶层或立即在另一个函数声明 [英] Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function

查看:4121
本文介绍了未捕获的语法错误:在严格模式下code,功能只能在顶层或立即在另一个函数声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,当我运行开发模式(服务器咕噜声)<一个项目href=\"https://github.com/kennethlynne/generator-angular-xl\">https://github.com/kennethlynne/generator-angular-xl一切正常,但是当我在生产模式(咕噜版本)运行它,我得到一个`

Hello when I run this project in Developer mode (grunt server) https://github.com/kennethlynne/generator-angular-xl everything is ok but when I run it in production mode (grunt build) I get an `

未捕获的语法错误:在严格模式下code,职能只能是
  在顶层或声明后立即在另一个函数

Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function

任何人有任何想法是怎么回事?
谢谢,

Anyone have any idea what's going on? Thanks,

诗。我张贴的链接项目,而不是code,因为JS在许多文件分割。

Ps. I posted a link to the project instead of code since the JS is split in many files.

推荐答案

我解决了这个问题的方法是通过删除使用严格的这是jquery的上述最后的精缩脚本。另一种方式可以改变jQuery的版本,以一个没有严格的错误

The way I solved the problem was by removing the 'use strict' that was above the jquery in the final minified script. Another way can be changing the jQuery version to one without the strict bug

编辑:毕竟这是对1.11版本jQuery的微小误差,一个简单的办法因为这是去你的步兵文件并注释掉行

After all it was a jQuery minification error on version 1.11, and an easy fix for this is to go to your Grunt file and comment out the line

banner: "'use strict';\n"

这篇关于未捕获的语法错误:在严格模式下code,功能只能在顶层或立即在另一个函数声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆