havardh / workflow

Workflow-centric workspace manager
154 stars 9 forks source link

Setup on headless linux fails #146

Open relekang opened 6 years ago

relekang commented 6 years ago

I have a vm that I use to code on through a tmux/vim setup, when I tried to use workflow to setup the tmux workspace I did not get past initial setup of workflow.

~ » workflow    
It looks like you are using workflow for the first time.

Workflow requires a workflow-home directory.
The workflow-home directory defaults to /home/rolf/.workflow
The default location can be overriden by the environment variable WORKFLOW_HOME

prompt: Would you like to initialize a workflow-home directory at: /home/rolf/.workflow (y/n):  (y)
npx: installed 22 in 3.938s
/bin/sh: 1: i3-msg: not found
Error: Cannot initialize platform linux-wmctrl
    at resolvePlatformWorkflowWm (/home/rolf/.npm/_npx/11092/lib/node_modules/create-workflow-home/dist/index.js:164:13)
    at readVersions (/home/rolf/.npm/_npx/11092/lib/node_modules/create-workflow-home/dist/index.js:141:28)
    at createPackageJson (/home/rolf/.npm/_npx/11092/lib/node_modules/create-workflow-home/dist/index.js:113:20)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
    at Function.Module.runMain (module.js:696:11)
    at findNodeScript.then.existing (/home/rolf/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/libnpx/index.js:268:14)
    at <anonymous>

Running `npm install`
npm WARN saveError ENOENT: no such file or directory, open '/home/rolf/.workflow/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/rolf/.workflow/package.json'
npm WARN .workflow No description
npm WARN .workflow No repository field.
npm WARN .workflow No README data
npm WARN .workflow No license field.

up to date in 1.21s
found 0 vulnerabilities

workflow was successfully installed.

Try the example with `workflow Example.js`
module.js:550
    throw err;
    ^

Error: Cannot find module '/home/rolf/.workflow/config.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/rolf/.nvm/versions/node/v8.12.0/lib/node_modules/workflow/node_modules/workflow-cmd/dist/index.js:124:18)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
havardh commented 6 years ago

The create-workflow-home module does not support initializing other than on linux with i3 :/.

Workaround

Manually set up the .workflow folder with a config.js file and a package.json. You can look at the templates, to get an idea of what do to. I assume that you would want to use the workflow-wm-terminal in this setup. Running workflow should then pick up this folder and you should be good.

Solution

create-workflow-home should detect that you are running headless and pick workflow-wm-terminal in this case.

There are two changes to be made to make this happen:

  1. Expand shared/env to return wm = terminal when running headless
  2. Make resolvePlatformWorkflowWm translate linux-terminal to workflow-wm-terminal.