A valid TW5_BUILD_OUTPUT directory must be set: what does TW5 specifically want? #73

Closed
pleabargain opened this Issue Mar 18, 2013 · 26 comments

Projects

None yet

4 participants

@pleabargain

I just cloned the src today.

Trying to build TW5(which by the way is not documented on the site or in the readme.md docs)

$ /usr/local/src/TiddlyWiki5 $ ./bld.sh
A valid TW5_BUILD_OUTPUT directory must be set

I used the current directory

$ /usr/local/src/TiddlyWiki5 $ ./bld.sh /usr/local/src/TiddlyWiki5
A valid TW5_BUILD_OUTPUT directory must be set

@Jermolene
Owner

Hi @pleabargain, thanks for the feedback, and I'm sorry that you were frustrated in your attempt to explore TiddlyWiki5.

I've updated the docs to give more detail - see the readme at https://github.com/Jermolene/TiddlyWiki5. Do please let me know if that's clear enough to get you up and running.

@Jermolene Jermolene closed this Mar 18, 2013
@pleabargain

Thank you for your very fast reply to my question/issue. Unfortunately, I've not made any more progress. I have tried many variations on the many build options but none seem to work. Here's the video showing my efforts:
http://youtu.be/BxW7hW8GWkg

dennis@64maya /usr/local/src $ cd TiddlyWiki5/

dennis@64maya /usr/local/src/TiddlyWiki5 $ ls
2bld.sh core editions plugins serve.sh wbld.sh
bld.sh dbld.sh package.json readme.md tiddlywiki.js

dennis@64maya /usr/local/src/TiddlyWiki5 $ ./bld.sh
A valid TW5_BUILD_OUTPUT directory must be set

dennis@64maya /usr/local/src/TiddlyWiki5 $ tiddlywiki.js
tiddlywiki.js: command not found

dennis@64maya /usr/local/src/TiddlyWiki5 $ ./serve.sh
./serve.sh: line 5: node: command not found

dennis@64maya /usr/local/src/TiddlyWiki5 $ ./bld.sh /usr/local/src/TiddlyWiki5/
A valid TW5_BUILD_OUTPUT directory must be set

dennis@64maya /usr/local/src/TiddlyWiki5 $ mkdir test
mkdir: cannot create directory `test': Permission denied

dennis@64maya /usr/local/src/TiddlyWiki5 $ sudo ./bld.sh
[sudo] password for dennis:
A valid TW5_BUILD_OUTPUT directory must be set

dennis@64maya /usr/local/src/TiddlyWiki5 $ sudo mkdir test

dennis@64maya /usr/local/src/TiddlyWiki5 $ sudo ./bld.sh test
A valid TW5_BUILD_OUTPUT directory must be set

dennis@64maya /usr/local/src/TiddlyWiki5 $ sudo ./serve.sh
./serve.sh: line 5: node: command not found

I want to use TW5 on my desktop to test and then maybe run it in dropbox for my wife and I to share.

Your patience and understanding and assistance are very much appreciated.

with regards
Dennis
p.s. If you can help me get TW5 to run, I promise I'll make a video and post it to YT so everyone will be able to benefit.

thanks again

@Jermolene
Owner

Hi Dennis

Thanks for your patience. The video is very helpful, thanks for going to the trouble.

The first thing is that it looks like you need to install node.js from http://nodejs.org/; it's needed for running TiddlyWiki5 from the command line.

I think the other source of confusion is that TW5_BUILD_OUTPUT is an environment variable, not a command line option. Rather than bothering with creating a separate batch file to set it, you may find it easier to create a directory called /usr/local/src/jermolene.github.com/, before you run bld.sh.

I've made some updates to the docs in the light of your feedback. TiddlyWiki5 is still very much a work in progress, but I hope you enjoy experimenting with it, and much appreciate your offer of further videos.

Many thanks,

Jeremy

@pleabargain

Hello Jeremy
Thank you for your continued assistance! I've installed node.js but it coughs on startup with

throw e; // process.nextTick error, or 'error' event on first tick

Not sure why, have any clues? That error seems to be a somewhat general error as many people have posted about it but I've yet to find the fix.

FWIW here's the vid showing the install of node.js
http://www.youtube.com/watch?v=DdDebDdFsHU

and node.js coughing on TiddlyWiki and a simple node server script
http://youtu.be/j2R0LKvcfZ0

again many thanks
Dennis
node_cough_Screenshot-1

@Jermolene
Owner

Hi Dennis

That "process.nextTick error" is pretty generic. It happens when node encounters an error that hasn't been trapped in certain circumstances. The real meat is immediately below, including the pointer to TiddlyWiki5's boot.js file. The underlying problem is that TW5 is not finding the content that it expects when it reads the package.json file that is right there in your directory listing.

In fact, running node tiddlywiki.js for me also gives an error, because the way things are set up at the moment you need to set some command line options and/or to have the current working directory being a valid TW5 wiki folder. That's probably a mistake, so I'll fix things so that running with no arguments issues a suitable message.

Anyhow, I can't quite see why you're getting a different error. What happens if you run ./bld.sh, having created the jermolene.github.com folder as directed above?

Many thanks,

Jeremy

@pleabargain

Hello Jeremy
Thanks again for the quick replies. I feel honored!

re: run ./bld.sh, having created the jermolene.github.com
No joy. See screen grab.
Same error:A valid TW5_BUILD_OUTPUT directory must be set

Here's the directories:
dennis@64maya /usr/local/src $ ls
build ipython ipython_extensions node TiddlyWiki5

Could it be a permissions issue for the contents of either node or tiddlywiki?
I'm thinking about trying:

sudo find node/ -type d -exec chmod 755 {} \;
sudo find TiddlyWiki5/ -type d -exec chmod 755 {} \;

What do you think?

again thanks,
Dennis
jermolene_Screenshot-1

@Jermolene
Owner

Hi Dennis

Happy to help. And apologies if the instructions aren't clear - the jermolene.github.com directory is meant to be parallel to your TiddlyWiki5 directory - ie, at /usr/local/src/jermolene.github.com/.

Best wishes

Jeremy

@pleabargain

Yeah! We got something different... though not what we want.

./bld.sh
and
sudo ./bld.sh
throw
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick

something_diff_Screenshot-1

@Jermolene
Owner

Hi Dennis

The permission denied error at the top of ./bld.sh does suggest that the permissions for the jermolene.github.com directory are not letting the script create a subdirectory. I'm not Linux-y enough to know how to correct that, I'm afraid, but if you can figure it out I'll include it in the instructions.

It seems that your sudo has allowed the script to blast through that problem, and encounter what we might refer to as the Cannot read property 'node' of undefined error that we saw before. I've no idea what's going on here, and wondered if you could try the following hack to help track things down.

In boot.js, locate the line:

$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json"));

And then insert the following line immediately after it:

console.log("$tw.boot.bootPath",$tw.boot.bootPath,"$tw.packageInfo",$tw.packageInfo);

Then, please re-run bld.sh, and let me know the output.

Many thanks,

Jeremy

@pleabargain

I am beginning to suspect that there are permission problems with node.js and TiddlyWiki... though I'm not sure why... I'm able to run other apps out of /usr/local/src without issue e.g. Ipython.

Here's the output. Your help is much appreciated.

dennis@64maya /usr/local/src/TiddlyWiki5 $ ./bld.sh <<<<<<<<<<<<<<< Using TW5_BUILD_OUTPUT as [../jermolene.github.com]
./bld.sh: line 20: ../jermolene.github.com/CNAME: Permission denied
$tw.boot.bootPath /usr/local/src/TiddlyWiki5/core $tw.packageInfo { name: 'tiddlywiki',
preferGlobal: 'true',
version: '5.0.0-alpha.9',
author: 'Jeremy Ruston ',
description: 'a reusable non-linear personal web notebook',
contributors: [ { name: 'Jeremy Ruston', email: 'jeremy@jermolene.com' } ],
bin: { tiddlywiki: './tiddlywiki.js' },
main: './core/boot.js',
repository:
{ type: 'git',
url: 'https://github.com/Jermolene/TiddlyWiki5.git' },
keywords: [ 'tiddlywiki', 'tiddlywiki5', 'wiki' ],
dependencies: {},
devDependencies: {},
bundleDependencies: [],
license: 'BSD',
engines: { node: '>=0.8.2' } }

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /usr/local/src/TiddlyWiki5/core/boot.js:426:73
at Object. (/usr/local/src/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/usr/local/src/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)
dennis@64maya /usr/local/src/TiddlyWiki5 $ sudo ./bld.sh <<<<<<<<<<<<<<<<< [sudo] password for dennis:
Using TW5_BUILD_OUTPUT as [../jermolene.github.com]
$tw.boot.bootPath /usr/local/src/TiddlyWiki5/core $tw.packageInfo { name: 'tiddlywiki',
preferGlobal: 'true',
version: '5.0.0-alpha.9',
author: 'Jeremy Ruston ',
description: 'a reusable non-linear personal web notebook',
contributors: [ { name: 'Jeremy Ruston', email: 'jeremy@jermolene.com' } ],
bin: { tiddlywiki: './tiddlywiki.js' },
main: './core/boot.js',
repository:
{ type: 'git',
url: 'https://github.com/Jermolene/TiddlyWiki5.git' },
keywords: [ 'tiddlywiki', 'tiddlywiki5', 'wiki' ],
dependencies: {},
devDependencies: {},
bundleDependencies: [],
license: 'BSD',
engines: { node: '>=0.8.2' } }

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /usr/local/src/TiddlyWiki5/core/boot.js:426:73
at Object. (/usr/local/src/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/usr/local/src/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)

@BoyCook

To avoid permissions issues I would try running TW5 from your user home directory ($HOME). So (assuming your login ID is pleabargain) /home/pleabargain.

@pleabargain

@BoyCook
No joy. See below, but thanks. Are you running node on a linux box? What perms are set for your dirs/files?
I think root owns everything... which may not be the right way to run node... I don't know! :(

Mine:
dennis@64maya /usr/local/src/node $ ls -l
total 204
-rw-r--r-- 1 root root 8360 Mar 18 14:50 AUTHORS
drwxr-xr-x 4 root root 4096 Mar 18 14:50 benchmark
-rw-r--r-- 1 root root 61 Mar 18 14:50 BSDmakefile
-rw-r--r-- 1 root root 56428 Mar 18 14:50 ChangeLog
-rw-r--r-- 1 root root 6089 Mar 18 14:50 common.gypi
-rwxr-xr-x 1 root root 388 Mar 18 14:50 configure
-rwxr-xr-x 1 root root 6397 Mar 18 14:50 configure-gyp
drwxr-xr-x 7 root root 4096 Mar 18 14:50 deps
drwxr-xr-x 5 root root 4096 Mar 18 14:50 doc
drwxr-xr-x 2 root root 4096 Mar 18 14:50 lib
-rw-r--r-- 1 root root 3422 Mar 18 14:50 LICENSE
-rw-r--r-- 1 root root 3712 Mar 18 14:50 Makefile
-rw-r--r-- 1 root root 10204 Mar 18 14:50 Makefile-gyp
lrwxrwxrwx 1 root root 16 Mar 18 14:53 node -> out/Release/node
-rw-r--r-- 1 root root 6644 Mar 18 14:50 node.gyp
drwxr-xr-x 6 root root 4096 Mar 18 14:53 out
-rw-r--r-- 1 root root 1228 Mar 18 14:50 README.md
-rw-r--r-- 1 root root 700 Mar 18 15:10 server.node.js
-rw-r--r-- 1 root root 700 Mar 18 15:10 server.node.js~
drwxr-xr-x 2 root root 4096 Mar 18 14:50 src
drwxr-xr-x 8 root root 4096 Mar 18 14:50 test
drwxr-xr-x 8 root root 4096 Mar 18 14:51 tools
-rw-r--r-- 1 root root 0 Mar 18 15:09 Untitled Document
-rw-r--r-- 1 root root 3812 Mar 18 14:50 vcbuild.bat
-rw-r--r-- 1 root root 34735 Mar 18 14:50 wscript

Here's running TW5 from home.

dennis@64maya ~ $ pwd
/home/dennis

dennis@64maya ~ $ node /usr/local/src/TiddlyWiki5/tiddlywiki.js
$tw.boot.bootPath /usr/local/src/TiddlyWiki5/core $tw.packageInfo { name: 'tiddlywiki',
preferGlobal: 'true',
version: '5.0.0-alpha.9',
author: 'Jeremy Ruston jeremy@jermolene.com',
description: 'a reusable non-linear personal web notebook',
contributors: [ { name: 'Jeremy Ruston', email: 'jeremy@jermolene.com' } ],
bin: { tiddlywiki: './tiddlywiki.js' },
main: './core/boot.js',
repository:
{ type: 'git',
url: 'https://github.com/Jermolene/TiddlyWiki5.git' },
keywords: [ 'tiddlywiki', 'tiddlywiki5', 'wiki' ],
dependencies: {},
devDependencies: {},
bundleDependencies: [],
license: 'BSD',
engines: { node: '>=0.8.2' } }

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /usr/local/src/TiddlyWiki5/core/boot.js:426:73
at Object. (/usr/local/src/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/usr/local/src/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)

@Jermolene
Owner

I'm very confused. The test code that you inserted shows that at line 424 of core/boot.js we've got a value for $tw.packageInfo.engines.node, and then the error at line 426 is because the member engines of $tw.packageInfo is not defined. That doesn't make sense at all, and yet I can't see where I'm going wrong. I'll continue to ponder it.

It is clear, though, that there is still a problem with permissions on the jermolene.github.com directory. So maybe it's worth trying to sort those permission issues out first as @BoyCook suggests, and go on from there.

Cheers

Jeremy.

@pleabargain

Sorry, the previous command was not run from ~ but I still got the same errors.

I'm growing more convinced it has something to do with the permissions of the node directory in /usr/local/src/node... but I'm not sure of the exact fix yet.

dennis@64maya ~ $ pwd
/home/dennis
dennis@64maya ~ $ node /usr/local/src/TiddlyWiki5/tiddlywiki.js
$tw.boot.bootPath /usr/local/src/TiddlyWiki5/core $tw.packageInfo { name: 'tiddlywiki',
preferGlobal: 'true',
version: '5.0.0-alpha.9',
author: 'Jeremy Ruston jeremy@jermolene.com',
description: 'a reusable non-linear personal web notebook',
contributors: [ { name: 'Jeremy Ruston', email: 'jeremy@jermolene.com' } ],
bin: { tiddlywiki: './tiddlywiki.js' },
main: './core/boot.js',
repository:
{ type: 'git',
url: 'https://github.com/Jermolene/TiddlyWiki5.git' },
keywords: [ 'tiddlywiki', 'tiddlywiki5', 'wiki' ],
dependencies: {},
devDependencies: {},
bundleDependencies: [],
license: 'BSD',
engines: { node: '>=0.8.2' } }

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /usr/local/src/TiddlyWiki5/core/boot.js:426:73
at Object. (/usr/local/src/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/usr/local/src/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)

@BoyCook

I'm suggesting that you have the code in your home dir:

/home/dennis/TiddlyWiki5

I would do a fresh git clone to here and then execute the following commands

export TW5_BUILD_OUTPUT=/home/dennis/TiddlyWiki5
./bld.sh

.

@Jermolene
Owner

Hi @BoyCook - that will leave the build products in the TiddlyWiki5 directory, wouldn't it be better for them to go outside that directory? Thanks Jeremy

@BoyCook

Yes sure. I was just trying to make the command as simple as possible :-)

@pleabargain

cloned TW5 to home dir and ran export. No joy. Same error.
TypeError: Cannot read property 'node' of undefined
at /home/dennis/TiddlyWiki5/core/boot.js:426:73

I unistalled node and reinstalled on the home directory.

dennis@64maya ~/TiddlyWiki5 $ which node
/usr/local/bin/node (this is where it appeared with install on /usr/local/src AND /home/dennis)

This is quite the curious problem, I would say... but still have no solution yet. Thanks to all for their continuing advice!

So BOTH TW5 and node.js are in my home/dennis and there is no diff in the errors: see screen grab
sdiff_Screenshot-1

dennis@64maya ~/TiddlyWiki5 $ node tiddlywiki.js

TypeError: Cannot read property 'node' of undefined

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /home/dennis/TiddlyWiki5/core/boot.js:426:73
at Object. (/home/dennis/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/home/dennis/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)

So, maybe it's not a permission problem?... I don't know.

This is what I got BEFORE installing node in /home/dennis

export TW5_BUILD_OUTPUT=/home/dennis/TiddlyWiki5
dennis@64maya ~ $ ls
01 Screwdriver Remix.mp3 dwhelper Music TiddlyWiki5
C:\nppdf32Log\debuglog.txt gif_maker My PhotoFilmStrips Videos
Desktop ipython extension-1.ogv Pictures ПОРТУГАЛИЯ.xlsx
Documents ipython extension-2.ogv Public
Downloads ipython extension.ogv Templates
Dropbox kdenlive terra-minoraПОРТУГАЛИЯ.ods
dennis@64maya ~ $ cd TiddlyWiki5/
dennis@64maya ~/TiddlyWiki5 $ ls
2bld.sh bld.sh core dbld.sh editions package.json plugins readme.md serve.sh tiddlywiki.js wbld.sh
dennis@64maya ~/TiddlyWiki5 $ ./bld.sh
Using TW5_BUILD_OUTPUT as [/home/dennis/TiddlyWiki5]

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'node' of undefined
at /home/dennis/TiddlyWiki5/core/boot.js:426:73
at Object. (/home/dennis/TiddlyWiki5/core/boot.js:1130:2)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/home/dennis/TiddlyWiki5/tiddlywiki.js:7:18)
at Module._compile (module.js:432:26)

@PVHL

I've been meaning to try out the build system (using WIndows), and seeing this thread prompted me to see how it works. I am getting a silent fail when I run ./bld.sh. It creates the static directory and the CNAME file, but nothing more. I'm checking into why.

BTW, I'm confused by a couple of things here. First, I added a $tw.utils.log call to boot.js to see some results and it broke the file; console.log worked OK. I expected the utils.log function to work in or out of the browser, but the code:

$tw.utils.log = function(/* args */) {
    if(console !== undefined && console.log !== undefined) {
        return window.console && console.log
            && Function.apply.call(console.log, console, arguments);
    }
};

contains an untested window.console reference; is this an error? The following amendment would have the intended behaviour of the original (returns undefined, false, or a log function), but works in server and browser:

$tw.utils.log = function(/* args */) {
    if(console !== undefined && console.log !== undefined) {
        return (!$tw.browser || ($tw.browser && window.console)) && console.log
        && Function.apply.call(console.log, console, arguments);
    }
};

(Just trying to Jeremy a few seconds here!)

Also, the sh.bld file contains the line --savetiddler ReadMe ./readme.md text/html. Why is ReadMe placed in the TW5 directory instead of the $TW5_BUILD_OUTPUT directory?

Thanks.

@PVHL

Sorry; I meant to say the updated function returns results of the console call, not the function itself.

@BoyCook

Can you try running this script:

./serve.sh

and then navigating to http://localhost:8080 in your browser.

It could be an issue with the way node.js is installed. Are you using the latest version? If you do:

node --version

do you get v0.10.0

@pleabargain

I'll get back to you... node is sticking like a thorn in my machine now... see http://stackoverflow.com/questions/15487183/how-to-delete-node-on-linux-mint-13

@Jermolene
Owner

@PVHL thanks for the feedback - you're right that $tw.utils.log is ropey, I'll look into it.

BTW, the fragment return window.console && console.log && Function.apply.call(console.log, console, arguments); works because && returns the value of the right hand operand if the left hand operand is truthy. So, the fragment is equivalent to if(window.console && console.log) {return Function.apply.call(console.log, console, arguments);} else {return undefined};

The reason that the readme file is put into the TiddlyWiki5 directory is so that GitHub picks it up as the readme for the repo. This allows us to maintain one set of documentation that is repurposed for the readme and the site itself.

@PVHL

You're welcome. And thanks for taking the time to answer me.

As to the && etc, I do get that; my point was that it doesn't work if called within the server -- it crashes, which I hate -- hence my alteration. And, of course, the code could be further simplified to:

$tw.utils.log = function(/* args */) {
    if (console !== undefined && console.log !== undefined) {
        return (!$tw.browser || ($tw.browser && window.console))
        && Function.apply.call(console.log, console, arguments);
    }
};

or even:

$tw.utils.log = function(/* args */) {
    if(console && console.log) {
        return (!$tw.browser || ($tw.browser && window.console))
        && Function.apply.call(console.log, console, arguments);
    }
};

The above should now work in the browser and the server. Actually the test below should also work, but is possibly a little more obscure to read:

$tw.utils.log = function(/* args */) {
    return console && console.log && (!$tw.browser || window.console)
        && Function.apply.call(console.log, console, arguments);
    }
};

Yes, I'm a little obsessive!

I didn't notice that the readme was just for building the site. Thanks.

Lovely to have interacted with you after admiring from afar for so many years. TW5 is looking really good. Most of the ideas I've been wanting to try on a similar project keep turning up here ... I may just modify TW5 instead of working on my next version.

@Jermolene
Owner

Hi @PVHL, thanks for the kind words, much appreciated.

Looking at this again I'm wondering if the function can't be simplified even further:


$tw.utils.log = function(/* args */) {
    if(console !== undefined && console.log !== undefined) {
        return Function.apply.call(console.log, console, arguments);
    }
};

That seems to work in Firefox and Chrome, not sure about IE.

A bit of research digs up this: https://github.com/cpatik/console.log-wrapper/blob/master/consolelog.js

Which rather makes me wonder if it's all worth it!

@PVHL

@Jermolene: Yes indeed; I assumed there was a reason for the window.console test in the original function that I was unaware of -- I'm used to seemingly arcane JS code having a historical purpose in some browser that I don't know about.

console.log-wrapper looks interesting, especially the simple Firebug lite injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment