linux - 在 Linux 上安装 iodocs

标签 linux node.js heroku amazon-ec2 iodocs

我有this problem最初,所以我尝试了

npm install --force

它似乎有效,只有一个警告:

npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dcada9b9aea5afa8aeb5b2bb9cecf2ecf2ed" rel="noreferrer noopener nofollow">[email protected]</a> package.json: bugs['web'] should probably be bugs['url']

但是当我尝试运行它时,它给了我:

[ec2-user@ip-10-136-14-95 iodocs]$ node ./app.js
The "sys" module is now called "util". It should have a similar interface.

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module 'hashlib'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/home/ec2-user/iodocs/app.js:37:19)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)

我不知道该怎么办,请给我一些启发。

顺便说一句,我正在尝试安装 iodocs在 Linux 2.6.35.14-97.44.amzn1.x86_64 EC2 实例上。

==============================更新================== ===============================

我也尝试将其安装在Heroku上,但遇到了同样的问题:

-----> Heroku receiving push
-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.6.12
       Using npm version: 1.0.106
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8dfcf8e8fff4fef9ffe4e3eacdbda3bda3bc" rel="noreferrer noopener nofollow">[email protected]</a> package.json: bugs['web'] should probably be bugs['url']
       npm ERR! Unsupported
       npm ERR! Not compatible with your version of node/npm: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e09195859299939492898e87a0d0ced0ced1" rel="noreferrer noopener nofollow">[email protected]</a>
       npm ERR! Required: {"node":"0.4.x","teleport":">=0.2.0"}
       npm ERR! Actual:   {"npm":"1.0.106","node":"0.6.12"}
       npm ERR! 
       npm ERR! System Linux 2.6.32-342-ec2
       npm ERR! command "/tmp/node-node-kXeE/bin/node" "/tmp/node-npm-1IT8/cli.js" "install"
       npm ERR! cwd /tmp/build_3mjp7psqka071
       npm ERR! node -v v0.6.12
       npm ERR! npm -v 1.0.106
       npm ERR! code ENOTSUP

       > <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="046c65776c686d6644352a342a35" rel="noreferrer noopener nofollow">[email protected]</a> preinstall /tmp/build_3mjp7psqka071/node_modules/hashlib
       > node-waf clean || true; node-waf configure build

       npm ERR! 
       npm ERR! Additional logging details can be found in:
       npm ERR!     /tmp/build_3mjp7psqka071/npm-debug.log
       npm not ok
       Nothing to clean (project not configured)
       Checking for program g++ or c++          : /usr/bin/g++ 
       Checking for program cpp                 : /usr/bin/cpp 
       Checking for program ar                  : /usr/bin/ar 
       Checking for program ranlib              : /usr/bin/ranlib 
       Checking for g++                         : ok  
       Checking for program gcc or cc           : /usr/bin/gcc 
       Checking for gcc                         : ok  
       Checking for node path                   : not found 
       Checking for node prefix                 : ok /tmp/node-node-kXeE 
       'configure' finished successfully (0.476s)
       Waf: Entering directory `/tmp/build_3mjp7psqka071/node_modules/hashlib/build'
       [1/6] cc: libhash/md4c.c -> build/Release/libhash/md4c_1.o
       [2/6] cc: libhash/md5c.c -> build/Release/libhash/md5c_1.o
       [3/6] cc: libhash/sha0c.c -> build/Release/libhash/sha0c_1.o
       [4/6] cxx: hashlib.cc -> build/Release/hashlib_2.o
       ../hashlib.cc:14:16: error: ev.h: No such file or directory
       ../hashlib.cc:15:17: error: eio.h: No such file or directory
       ../hashlib.cc:311: error: 'eio_req' was not declared in this scope
       ../hashlib.cc:311: error: 'req' was not declared in this scope
       ../hashlib.cc:312: error: expected ',' or ';' before '{' token
       Waf: Leaving directory `/tmp/build_3mjp7psqka071/node_modules/hashlib/build'
       Build failed:  -> task failed (err #1): 
        {task: cxx hashlib.cc -> hashlib_2.o}
 !     Failed to install dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

最佳答案

我也遇到过同样的问题。

我认为有一个“拉取请求”可以解决这个问题: https://github.com/mashery/iodocs/pull/14

我将实现它,如果有效,我会报告。

编辑:

我能够走得更远。以下是您需要做的一些事情:

  1. 实现上面链接的拉取请求
  2. 在 package.json 中,更新您的 "express": "2.5.8" (他们的版本 2.4.8 与 node.js v1.0.0 不兼容
  3. 从“iosdocs/node_modules”中删除“hashlib”目录

npm install 现在应该可以工作了。

但是,如果您运行 node ./app.js,我会收到此错误:

The "sys" module is now called "util". It should have a similar interface. Express server listening on port 3000

node.js:201 throw e; // process.nextTick error, or 'error' event on first tick

编辑#2:

想通了!您必须实际运行 redis-server (DUH)。

所以我做了以下事情:

  1. Download redis 2.4.8 from their site
  2. 按照他们的说明进行解压缩、构建
  3. 使用src/redis-server运行服务器

Bam,现在运行 node ./app.js 就可以了!

关于linux - 在 Linux 上安装 iodocs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9577988/

相关文章:

sql - 数据设置为 json with group

ruby-on-rails - 远程 : ! 预编译 Assets 失败。 (英雄)

linux - 在 Python 2.7 中编码时如何处理 Linux 上带空格的路径?

c - stdio header 中的 _iob 声明

linux - 如何从Linux机器将公钥放入sftp服务器?

linux - 动态库查找ld的规则是什么?

javascript - 如何启动这个 Node.JS 应用程序?

node.js - 将 Node Inspector 与 Derby App 结合使用?

ruby-on-rails - Heroku 无法检测到 rake 任务(LoadError : cannot load such file -- rspec/core/rake_task)

MySQL (ClearDB) 不适用于 Heroku