咖啡脚本path.exists从node.js中弃用了通知

  • OSX 10.6
  • CoffeeScript 1.2.0
  • node.js v0.7.7-pre

每次运行咖啡命令时,我都会看到一个弃用通知。 通知是这样的:

path.exists is deprecated. It is now called `fs.exists`. 

我知道这是因为node.js不推荐使用path.exists。 看到

https://github.com/joyent/node/pull/2587

我想可能会有很多关于这方面的信息,但我所能看到的只是间接提及一个更严重的问题,说这个问题不会是“固定的”:

https://github.com/jashkenas/coffee-script/issues/2113

我是唯一有这个问题的人吗? 有没有人有关于如何使这个消失的build议?

https://github.com/jashkenas/coffee-script/blob/master/lib/coffee-script/command.js#L323

在coffeescript源代码中有对path.exists的引用。

请注意,在节点0.6(当前的稳定版本) fs.exists为null,所以很难干净地升级它。

我们有一个问题,即0.6和0.7都不能使用相同的源代码。

我会假设,我们等待0.8,然后有人会升级咖啡标记使用fs.exists和弃用0.6支持

在等待0.8时,在OSX上,您可以通过将所有path.existsreplace为文件中的fs.exists (如果全局安装)来暂时解决此问题:

/opt/local/lib/node_modules/coffee-script/lib/coffee-script/command.js

编辑时不要忘记使用root权限。

这是一个迟到的答案,但有一个补丁模块,旨在暂时解决这个问题,直到每个人都有机会更新代码。

https://github.com/SportZing/node-exists-patch

难道你不能只是改变源代码中的所有实例吗?

Interesting Posts