Firefox插件错误:在resource://gre/modules/commonjs/http.js上找不到模块`path` [英] Firefox Addon error: Module `path` is not found at resource://gre/modules/commonjs/http.js

查看:133
本文介绍了Firefox插件错误:在resource://gre/modules/commonjs/http.js上找不到模块`path`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Firefox插件, 操作系统是Windows10,节点v5.8.0和npm v3.5.3,Firefox v.45.0

I am writing a Firefox add-on, OS is Windows10, node v5.8.0 and npm v3.5.3, Firefox v.45.0

导致错误的行是:

var path = require("path");

错误消息是:

Message: Module `http` is not found at resource://gre/modules/commonjs/http.js

但是,以下方法可以工作:

The following works though:

var system = require("sdk/system");

我在节点的其他核心模块上尝试过require,所有这些模块都返回上面的错误消息(例如pathutil).似乎所有核心​​节点模块都不起作用或找不到.

I tried require with other core modules of node and all of them return the error message above (for instance path and util). It seems like none of the core node modules work or can be found.

我今天几次重新启动了节点和npm(在故障排除和对类似问题的回答之后),NODE_PATH设置为%AppData%\npm,我的PATH中有...\npm\bin...\npm\node_modules.

I have reistalled node and npm today a few times (following troubleshooting and responses to similar questions), NODE_PATH is set to%AppData%\npm, I have ...\npm\bin and ...\npm\node_modules in my PATH.

对于解决上述问题的任何想法和帮助,将不胜感激.

Any ideas and help how to resolve the above would be much appreciated.

非常感谢

al

推荐答案

现在, fs/path的文档为空,但使用 child_process's one ,可以推断出需求应该为var path = require("sdk/fs/path");

Right now, fs/path's doc is empty but using child_process's one, one can infer that the require should be var path = require("sdk/fs/path");

这篇关于Firefox插件错误:在resource://gre/modules/commonjs/http.js上找不到模块`path`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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