Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 永远在安全的环境中奔跑,永不开火,永不停歇_Node.js_Ansible_Forever - Fatal编程技术网

Node.js 永远在安全的环境中奔跑,永不开火,永不停歇

Node.js 永远在安全的环境中奔跑,永不开火,永不停歇,node.js,ansible,forever,Node.js,Ansible,Forever,我在Ansible节点上尝试启动永久进程时遇到了Ansible挂起问题。我在vagrant中创建了一个非常简单的API服务器,并使用Ansible进行配置,如下所示: --- - hosts: all sudo: yes roles: - Stouts.nodejs - Stouts.mongodb tasks: - name: Install Make Dependencies apt: name={{ item }} state=prese

我在Ansible节点上尝试启动
永久
进程时遇到了Ansible挂起问题。我在vagrant中创建了一个非常简单的API服务器,并使用Ansible进行配置,如下所示:

---
- hosts: all
  sudo: yes

  roles:
    - Stouts.nodejs
    - Stouts.mongodb

  tasks:
    - name: Install Make Dependencies
      apt: name={{ item }} state=present
      with_items:
        - gcc
        - make
        - build-essential

    - name: Run NPM Update
      shell: /usr/bin/npm update

    - name: Create MongoDB Database Folder
      shell: /bin/mkdir -p /data/db
      notify:
        - mongodb restart

    - name: Generate Dummy Data
      command: /usr/bin/node /vagrant/dataGen.js

    - name: "Install forever (to run Node.js app)."
      npm: name=forever global=yes state=latest

    - name: "Check list of Node.js apps running."
      command: /usr/bin/forever list
      register: forever_list
      changed_when: false

    - name: "Start example Node.js app."
      command: /usr/bin/forever start /vagrant/server.js
      when: "forever_list.stdout.find('/vagrant/server.js') == -1"
但是,即使Ansible表现得好像一切都很好,也没有永远的过程开始。当我更改几行以删除
When:
语句并强制它运行时,Ansible只需手动,可能会运行永久进程(我想是永久的),但不会启动VM到可以与之交互的位置


我在网上基本上引用了两点;我可以找到。

您是否尝试在vm中手动运行它?只是想知道是ansible还是forever本身有问题。你的问题忽略了变量的输出。stdout要有用,我会放入
-debug:var=forever\u list。stdout
进行检查