“cake build:browser”和Uglify.js出错 - 无法读取未定义的属性“Array”

时间:2011-05-10 02:53:18

标签: javascript node.js coffeescript uglifyjs

我刚安装了Uglify.js并尝试使用它来重建CoffeeScript,但一直收到此错误。当我在CoffeeScript目录中键入“cake build:browser”时会发生这种情况。 (我想尝试修改CoffeeScript语言。)

我的Uglify.js是从GitHub克隆的,符号链接是在.node_libraries中创建的。 Uglify已正确安装,已确认,因为它在Node中正常运行并通过命令行运行。所以这可能是一个CoffeeScript问题。

帮助?

/Users/myuser/projects/UglifyJS/lib/process.js:475
                        return options.defines[name];
                                              ^
TypeError: Cannot read property 'Array' of undefined
    at get_define (/Users/myuser/projects/UglifyJS/lib/process.js:475:47)
    at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:527:32)
    at walk (/Users/myuser/projects/UglifyJS/lib/process.js:215:47)
    at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:164:59)
    at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)
    at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:146:43)
    at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)
    at /Users/myuser/projects/UglifyJS/lib/process.js:1643:37
    at Array._block (/Users/myuser/projects/UglifyJS/lib/process.js:81:34)
    at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)

1 个答案:

答案 0 :(得分:1)

好的,我能够复制这个。但是你为什么要克隆UglifyJS回购?如果您只是npm install uglify-js安装到本地node-modules目录(使用npm 1.x),一切运行正常。

类似问题:https://github.com/mishoo/UglifyJS/issues/140