【问题标题】:Installing Titanium ACS安装钛 ACS
【发布时间】:2013-07-01 13:41:03
【问题描述】:

我们正在尝试通过命令行安装 Titaniums ACS,使用

sudo npm -g install acs

但是它一直失败,我们得到以下错误

npm http GET https://registry.npmjs.org/bindings

> bson@0.0.4 install /usr/local/lib/node_modules/acs/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson
> node install.js

sh: node: command not found
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "acs" "--color" "false"
npm ERR! cwd /Users/titanium
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf
npm ERR! fstream_path /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! bson@0.0.4 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 127
npm ERR! 
npm ERR! Failed at the bson@0.0.4 install script.
npm ERR! This is most likely a problem with the bson package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls bson
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "acs" "--color" "false"
npm ERR! cwd /Users/titanium
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/qs/0.5.1
npm http 304 https://registry.npmjs.org/pause/0.0.1
npm http 304 https://registry.npmjs.org/send/0.0.4
npm http 304 https://registry.npmjs.org/bytes/0.1.0
npm http 304 https://registry.npmjs.org/bindings

> hiredis@0.1.15 install /usr/local/lib/node_modules/acs/node_modules/socket.io/node_modules/redis/node_modules/hiredis
> node-gyp rebuild

/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: line 2: node: command not found
npm WARN optional dep failed, continuing hiredis@0.1.15
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/titanium/npm-debug.log
npm ERR! not ok code 0
iMac:~ titanium$ node-gyp
-bash: node-gyp: command not found
iMac:~ titanium$ hiredis
-bash: hiredis: command not found
iMac:~ titanium$ apt-get install homebrew
-bash: apt-get: command not found
iMac:~ titanium$ node
> echo 1
... exit
... no
... 
> 
(^C again to quit)
> 
iMac:~ titanium$ node install.js

module.js:340
    throw err;
          ^
Error: Cannot find module '/Users/titanium/install.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:245:9)

但是,我们可以在终端中输入 node 并且它运行良好,并且节点功能的负载完美运行。

如果有人对此问题有任何见解,那将非常有帮助。

谢谢

【问题讨论】:

    标签: node.js titanium


    【解决方案1】:

    您是否尝试过清除 npm 缓存?

    npm cache clean
    

    【讨论】:

    • 我没有,但我在 3 个不同的用户上尝试过,他们没有安装 node 或 npm,所以看不出缓存肯定是个问题?
    【解决方案2】:

    对于 sudo 用户来说,节点似乎不在 PATH 中。

    要么像给定的here 那样为 sudo 设置节点,要么使用 sudo -E 选项运行它。

    【讨论】:

    • 嗨,我尝试了该帖子中提到的命令,但是在重新启动并再次尝试后,我得到了完全相同的错误,我也尝试了 sudo -e 并再次尝试在同一点失败。有人有其他建议吗?
    • -g 和-e 有什么区别?以及为什么我可以在后面安装成功,而不是在第一次安装?
    【解决方案3】:

    不要在root权限下使用npm,这是不安全的。

    我建议您将/usr/local 的所有权授予您的用户,这样做您可以这样做

    sudo chown -R $USER /usr/local
    

    根据npm作者的建议:http://howtonode.org/introduction-to-npm

    我尝试在没有 sudo 的情况下安装它并且工作正常。

    【讨论】:

      【解决方案4】:

      在安装 CLI 之前,您应该确定节点包管理器 (npm) 安装包的位置。默认情况下,npm 在 OS X 和 Linux 上安装到 /usr/local,这要求您以 root 身份运行 npm。不建议这样做。您可以通过执行以下操作之一来避免运行 npm:

      Make the /usr/local directory writable by all:
      
      sudo chmod 777 /usr/local
      
      Set npm to install to your home directory, or another directory of your choosing by setting the npm prefix. For example, you can add the following to your .bash_profile or other initialization file:
      
      export NPM_CONFIG_PREFIX=$HOME
      
      Alternately, you can create a .npmrc file in your home directory with the following contents:
      
      prefix=/path/to/home
      
      Where /path/to/home is the path to your home directory. Setting the npm prefix to your home directory causes the npm packages to be installed to $HOME/lib/node_modules and launch scripts are installed in $HOME/bin. $HOME/bin must be in your PATH.
      

      如果在安装 npm 包后更改前缀,则必须重新安装包。如果在以 root 身份安装软件包后更改 /usr/local 的权限,则可能需要更改 npm 缓存文件夹的所有权,如排除 npm 问题中所述。 排查 npm 问题

      如果您在安装任何 npm 包时遇到问题,请尝试以下操作:

      Check permissions. If you originally ran npm using sudo, you may need to change the ownership of the npm cache folder.
      
      sudo chown -R <username> ~/.npmrc
      
      On Windows, the npm cache defaults to npm-cache in the user's home directory.
      
      Clear the npm package cache:
      
      npm cache clean
      
      Remove your .npmrc file.
      

      【讨论】:

        猜你喜欢
        • 2015-03-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多