繁体   English   中英

找不到模块/build/Debug/iconv.node

[英]Cannot find module /build/Debug/iconv.node

我正在尝试在Ubuntu VM上运行node.js服务器。

我一直收到这个错误:

Error: Cannot find module '../build/Debug/iconv.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/vagrant/api/node_modules/geoipcity/node_modules/iconv/lib/iconv.js:27:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/vagrant/api/node_modules/geoipcity/geoipcity.js:35:13)

这行代码:

/vagrant/api/node_modules/geoipcity/node_modules/iconv/lib/iconv.js:27:14

看起来像这样:

var bindings;
try {
  bindings = require('../build/Release/iconv.node');
}
catch (e) {
  bindings = require('../build/Debug/iconv.node');
}

奇怪的是,当我浏览目录结构时,这个文件存在:

/vagrant/api/node_modules/geoipcity/node_modules/iconv/build/Release/iconv.node 

所以我不确定为什么试试catch块会被抓住。 实际上,正如我写的最后一句话,我决定尝试记录被捕获的错误。 它是:

[Error: /vagrant/api/node_modules/geoipcity/node_modules/iconv/build/Release/iconv.node: invalid ELF header]

不确定这是否相关,但我尝试运行:

node-gyp rebuild

有了这个结果

gyp info it worked if it ends with ok gyp info using node-gyp@0.13.0 gyp info using node@0.10.26 | linux | ia32 gyp info spawn python gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/vagrant/api/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/vagrant/.node-gyp/0.10.26/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/vagrant/.node-gyp/0.10.26', gyp info spawn args '-Dmodule_root_dir=/vagrant/api', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp: binding.gyp not found (cwd: /vagrant/api) while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:340:16) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) gyp ERR! System Linux 3.2.0-23-generic-pae gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /vagrant/api gyp ERR! node -v v0.10.26 gyp ERR! node-gyp -v v0.13.0 gyp ERR! not ok

好的,这就是我现在所拥有的一切。 如果我发现任何新内容,将继续搜索解决方案并在此更新。

在此先感谢您的帮助。 哦,请温柔 - 我是一个Linux菜鸟。

通过转到iconv目录并运行:

node-gyp configure
node-gyp build

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM