V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ooTwToo
V2EX  ›  问与答

CentOS 下 安装 PM2 问题,求指教!

  •  1
     
  •   ooTwToo · 2015-10-23 09:16:50 +08:00 · 5209 次点击
    这是一个创建于 3320 天前的主题,其中的信息可能已经有所发展或是发生改变。
    # npm install -g pm2
    npm WARN optional dep failed, continuing [email protected]
    /usr/local/software/node-v4.2.1-linux-x86/bin/pm2 -> /usr/local/software/node-v4.2.1-linux-x86/lib/node_modules/pm2/bin/pm2
    /usr/local/software/node-v4.2.1-linux-x86/bin/pm2-dev -> /usr/local/software/node-v4.2.1-linux-x86/lib/node_modules/pm2/bin/pm2-dev
    [email protected] /usr/local/software/node-v4.2.1-linux-x86/lib/node_modules/pm2
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected]
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected]
    ?..?€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected]
    ?..?€ [email protected] ([email protected], [email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected]
    ?..?€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
    ?..?€ [email protected] ([email protected])
    ?..?€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
    ?..?€ [email protected]
    
    Error: language "linux" is not supported

    然后 输入指令: mp2

    -bash: pm2: command not found
    

    求指教!
    PS: 使用 PM2 是用来实现 Node.js 程序永久后台

    5 条回复    2015-10-23 09:38:32 +08:00
    ooTwToo
        1
    ooTwToo  
    OP
       2015-10-23 09:17:36 +08:00
    wsph123
        2
    wsph123  
       2015-10-23 09:21:10 +08:00
    Kuro
        3
    Kuro  
       2015-10-23 09:32:13 +08:00
    在 PATH 中加上 /usr/local/software/node-v4.2.1-linux-x86/bin/pm2 应该就没问题了。
    Kuro
        4
    Kuro  
       2015-10-23 09:37:14 +08:00
    噢,纠正一下,是 /usr/local/software/node-v4.2.1-linux-x86/bin/
    ooTwToo
        5
    ooTwToo  
    OP
       2015-10-23 09:38:32 +08:00
    @Kuro 谢谢前辈! 是 软连接的锅。

    在 /etc/profile 加上就 OK 了

    #set for nodejs
    export NODE_HOME=/usr/local/software/node-v4.2.1-linux-x86
    export PATH=$NODE_HOME/bin:$PATH
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2641 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:58 · PVG 18:58 · LAX 02:58 · JFK 05:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.