zoukankan      html  css  js  c++  java
  • centos 5.4 安装nodejs + npm(转)

    而在安装nodejs的时候,需要用到,所以需要手动安装bz2库。

    sudo yum install -y bzip2* 
    cd Python-2.7.2/Modules/zlib
    ./configure 
    make
    sudo make install

    还需要,打开binascii模块的编译。不然在安装node的时候,会提示找不到binascii模块。

    cd ../../
    vi Modules/Setup.dist

    找到下面的两行,将binascii前的注释去掉。

    # Helper module for various ascii-encoders
    #binascii binascii.c
    #改成如下两行:
    # Helper module for various ascii-encoders
    binascii binascii.c

    安装Nodejs

    wget http://nodejs.org/dist/v0.6.10/node-v0.6.10.tar.gz
    tar xzf node-v0.6.10.tar.gz
    cd node-v0.6.10
    ./configure                              //

    这个时候,会报错:

      Checking for program g++ or c++          : not found
        Checking for program icpc                : not found
        Checking for program c++                 : not found
        /home/admin/pkgs/node-v0.6.10/wscript:261: error: could not configure a cxx compiler!

    解决办法是:
    安装gcc-c++

    sudo yum install gcc-c++

    之后,会报错:

    Checking for openssl                     : not found
    Checking for function SSL_library_init   : not found
    Checking for header openssl/crypto.h     : not found
    /home/admin/pkgs/node-v0.6.10/wscript:374: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message.

    解决办法:安装openssl-devel

    sudo yum install openssl-devel

    然后,就可以正常编译安装了。

    ./configure
    make
    sudo make install

    nstall npm

    curl http://npmjs.org/install.sh | sudo sh

    提示网址有问题的话就改为curl https://npmjs.org/install.sh | sudo sh


    如果提示,找不到node,所以:
    再做一个软链接:

    sudo ln -s /usr/local/bin/node /usr/bin/node
    curl http://npmjs.org/install.sh | sudo sh

    可以正常运行。

  • 相关阅读:
    [vijos P1531] 食物链
    [USACO精选] 第二章 动态规划(一)
    python 二分法查找
    python 小试牛刀之信息管理
    C语言链表实现冒泡法排序
    [笔记]libgdx在一张pixmap上按照笔刷画图
    [libgdx]项目通过RoboVm编译到ios平台并运行的环境配置
    android中sqlite distinct中使用多个字段的方法
    libgdx游戏中的中文字体工具类
    C语言实现字符串拷贝 拷贝指定长度字符串 字符串连接
  • 原文地址:https://www.cnblogs.com/xingmeng/p/3345619.html
Copyright © 2011-2022 走看看