What is the issue or idea you have?
Unable to make an initial STF run
Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row.
I was able to run it on MacOSX previously.
Please provide the steps to reproduce the issue.
Installed it on Stretch debian
What is the expected behavior?
Should start the stf
Do you see errors or warnings in the stf local output? If so, please paste them or the full log here.
INF/storage:temp 21122 [*] Listening on port 7102
/usr/bin/nodejs ../lib/cli app
Opcje:
-h, --help Show help. [boolean]
-V, --version Show version. [boolean]
--auth-url, -a URL to the auth unit. [ci膮g znak贸w] [wymagany]
--port, -p The port to bind to. [liczba] [domy艣lny: 7105]
--secret, -s The secret to use for auth JSON Web Tokens. Anyone who
knows this token can freely enter the system if they
want, so keep it safe. [ci膮g znak贸w] [wymagany]
--ssid, -i The name of the session ID cookie.
[ci膮g znak贸w] [domy艣lny: "ssid"]
--user-profile-url URL to an external user profile page. [ci膮g znak贸w]
--websocket-url, -w URL to the websocket unit. [ci膮g znak贸w] [wymagany]
Each option can be be overwritten with an environment variable by converting the
option to uppercase, replacing dashes with underscores and prefixing it with
STF_APP_ (e.g. STF_APP_AUTH_URL).
"rootDirectory" not specified or is invalid
FTL/cli:local 21055 [] Child process had an error ExitError: Exit code "1"
at ChildProcess.
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
INF/cli:local 21055 [
Please run stf doctor and paste the output here.
INF/cli:doctor 21043 [] OS Arch: x64
INF/cli:doctor 21043 [] OS Platform: linux
INF/cli:doctor 21043 [] OS Platform: 4.9.0-3-amd64
INF/cli:doctor 21043 [] Using Node 6.11.2
INF/cli:doctor 21043 [] Using ZeroMQ 4.1.2
INF/cli:doctor 21043 [] Using RethinkDB 2.3.5~0stretch
INF/cli:doctor 21043 [] Using GraphicsMagick 1.3.25
INF/cli:doctor 21043 [] Using ProtoBuf 3.3.2
INF/cli:doctor 21043 [*] Using ADB 1.0.36
I've never resolved this issue myself, even after trying with:
Debian 7,8,9 and Ubuntu 14.04 and 16.04.
But was able to set it up via docker. So I'll close the ticket - but in case someone runs into such a problem like I did, I recommend trying with Docker. It took me like 30 seconds instead of 1 full day of trying.
i ran into this same issue on ubuntu 17.04 using the 'nodeenv' utility to download & setup the node/npm environment. this happened with both the latest stable (8.4.0) and latest lts (6.11.2) node.
to debug, i ran each command individually until i found the one that output the error that included at the bottom:
Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with STF_APP_ (e.g. STF_APP_AUTH_URL)."
this turned out to be the 'stf app' command, e.g:
./node_modules/stf/bin/stf app --user-profile-url http://localhost --websocket-url websocket://localhost --auth-url http://localhost
running that failed with the same error message about "rootDirectory" not specified or is invalid which actually comes from the markdownserver npm module.
anyhow, the ENOENT i noticed in the strace was this:
[pid 22147] stat("/home/matt/devel/nexus/openstf_nodeenv/node_modules/stf/node_modules/stf-wiki", 0x3c8ea9931d0) = -1 ENOENT (No such file or directory)
i guess the search path for the module wasn't right. i just worked around it by making a symlink like so:
(openstf_nodeenv)matt@aquos:~/devel/nexus/openstf_nodeenv/node_modules/stf$ ls -l node_modules
lrwxrwxrwx 1 matt matt 2 Aug 30 00:46 node_modules -> ..
everything started up fine after making the symlink. hope this saves somebody else an hour, lol.
Great detective work! I've personally never used nodeenv, and have never had issues with nvm, so an easier alternative may be to use nvm instead.
It could also be related to how you launch STF, for example ./node_modules/stf/bin/stf may not work, whereas bin/stf in the STF module folder may work. That's a complete guess, though.
hmm, haven't tried nvm. i want to say i went with nodeenv because it's in the ubuntu repos and i prefer to use a repo/.deb if possible. i might check it out anyways, though.
i did just now test executing it from different paths, e.g. bin/stf and stf/bin/stf, but it still failed to start with the same error message.
btw, this thing is really pretty cool :)
another quick note. that little recursive symlink breaks other stuff, like 'npm ls'. fails with npm ERR! Maximum call stack size exceeded. so, runtime of openstf isn't affected negatively, but doing other stuff with npm appears to be. hope this saves someone else another 10 minutes, lol.
This error happens with yarn, installing the global module with yarn.
Throws:
Each option can be be overwritten with an environment variable by converting the
option to uppercase, replacing dashes with underscores and prefixing it with
STF_APP_ (e.g. STF_APP_AUTH_URL).
Same for me using yarn 1.6.0 and trying to run "stf local"
2018-04-17T00:28:00.131Z INF/storage:temp 776 [*] Listening on port 7102
2018-04-17T00:28:00.138Z INF/reaper 741 [reaper001] Device "ZY224DVHBW" is present
cli app
Options:
-h, --help Show help. [boolean]
-V, --version Show version. [boolean]
--auth-url, -a URL to the auth unit. [string] [required]
--port, -p The port to bind to. [number] [default: 7105]
--secret, -s The secret to use for auth JSON Web Tokens. Anyone who
knows this token can freely enter the system if they
want, so keep it safe. [string] [required]
--ssid, -i The name of the session ID cookie.
[string] [default: "ssid"]
--user-profile-url URL to an external user profile page. [string]
--websocket-url, -w URL to the websocket unit. [string] [required]
Each option can be be overwritten with an environment variable by converting the
option to uppercase, replacing dashes with underscores and prefixing it with
`STF_APP_` (e.g. `STF_APP_AUTH_URL`).
"rootDirectory" not specified or is invalid
2018-04-17T00:28:00.366Z FTL/cli:local 710 [*] Child process had an error ExitError: Exit code "1"
at ChildProcess.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
2018-04-17T00:28:00.366Z INF/cli:local 710 [*] Shutting down all child processes
I guess it breaks here. Does /usr/local/share/.config/yarn/global/node_modules/stf/node_modules/stf-wiki exist? If not, how about /usr/local/share/.config/yarn/global/node_modules/stf-wiki?
Specifically the error is thrown here. Perhaps someone on an affected system can modify that file and do a console.log('rootDirectory is: ', rootDirectory) before the check?
Hi:
Same issue for me with node 8.15 + npm 6.7. I installed openstf using npm install stf, and run ./node_modules/.bin/stf local.(I don't want to install it globally because that require root access)
After changed this line https://github.com/lyphtec/markdown-serve/blob/v0.3.2/lib/server.js#L241 to output rootDirectory, I found rootDirectory is '/Users/XXX/node_modules/stf/node_modules/stf-wiki' which doesn't exists. The correct path should be /Users/XXX/node_modules/stf-wiki.
The problem is from this line: https://github.com/openstf/stf/blob/v3.4.0/lib/units/app/index.js#L30 . You assume stf-wiki is installed in stf directory, but sometimes npm or yarn may install it to somewhere else.
Here is my patch:
--- node_modules/stf/lib/units/app/index.js.old 2019-03-03 16:46:19.000000000 +0800
+++ node_modules/stf/lib/units/app/index.js 2019-03-03 16:52:26.000000000 +0800
@@ -1,6 +1,7 @@
var http = require('http')
var url = require('url')
var fs = require('fs')
+var path = require('path')
var express = require('express')
var validator = require('express-validator')
@@ -27,7 +28,7 @@
var server = http.createServer(app)
app.use('/static/wiki', markdownServe.middleware({
- rootDirectory: pathutil.root('node_modules/stf-wiki')
+ rootDirectory: path.dirname(require.resolve('stf-wiki/package.json'))
, view: 'docs'
}))
We need another patch to make openstf can be run from a local installation (./node_modules/.bin/stf local). Otherwise it will throw an error related to module file resolution:
2019-03-03T09:35:08.464Z FTL/device 16220 [NB1GAD1792805353] Setup had an error Error: At least one of these paths should exist: /Users/XXX/node_modules/stf/node_modules/minicap-prebuilt/prebuilt/arm64-v8a/bin/minicap, /Users
/XXX/node_modules/stf/node_modules/minicap-prebuilt/prebuilt/armeabi-v7a/bin/minicap, /Users/XXX/node_modules/stf/node_modules/minicap-prebuilt/prebuilt/armeabi/bin/minicap
at Object.module.exports.requiredMatch (/Users/XXX/node_modules/stf/lib/util/pathutil.js:33:9)
at /Users/XXX/node_modules/stf/lib/units/device/resources/minicap.js:24:23
--- node_modules/stf/lib/util/pathutil.js.old 2019-03-03 17:39:44.000000000 +0800
+++ node_modules/stf/lib/util/pathutil.js 2019-03-03 17:40:31.000000000 +0800
@@ -19,7 +19,10 @@
// Export
module.exports.module = function(target) {
- return path.resolve(__dirname, '../../node_modules', target)
+ try {
+ return require.resolve(target);
+ } catch (e) {
+ }
}
// Export
Most helpful comment
i ran into this same issue on ubuntu 17.04 using the 'nodeenv' utility to download & setup the node/npm environment. this happened with both the latest stable (8.4.0) and latest lts (6.11.2) node.
to debug, i ran each command individually until i found the one that output the error that included at the bottom:
Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with STF_APP_ (e.g. STF_APP_AUTH_URL)."this turned out to be the 'stf app' command, e.g:
./node_modules/stf/bin/stf app --user-profile-url http://localhost --websocket-url websocket://localhost --auth-url http://localhostrunning that failed with the same error message about
"rootDirectory" not specified or is invalidwhich actually comes from the markdownserver npm module.anyhow, the ENOENT i noticed in the strace was this:
[pid 22147] stat("/home/matt/devel/nexus/openstf_nodeenv/node_modules/stf/node_modules/stf-wiki", 0x3c8ea9931d0) = -1 ENOENT (No such file or directory)i guess the search path for the module wasn't right. i just worked around it by making a symlink like so:
(openstf_nodeenv)matt@aquos:~/devel/nexus/openstf_nodeenv/node_modules/stf$ ls -l node_moduleslrwxrwxrwx 1 matt matt 2 Aug 30 00:46 node_modules -> ..everything started up fine after making the symlink. hope this saves somebody else an hour, lol.