With npm, there are 2 possibilities to install a nodejs "executable"

as a global program
as a local program. 

The local version
---------------------

If you do 

$ cd ~
$ mkdir test-tw
$ npm install tiddlywiki

It creates a local version.

You should see something similar to this:

[mario:~/test-tw] $ 
-> npm install tiddlywiki
npm http GET https://registry.npmjs.org/tiddlywiki
npm http 200 https://registry.npmjs.org/tiddlywiki
npm http GET 
https://registry.npmjs.org/tiddlywiki/-/tiddlywiki-5.0.8-beta.tgz
npm http 200 
https://registry.npmjs.org/tiddlywiki/-/tiddlywiki-5.0.8-beta.tgz
tiddlywiki@5.0.8-beta node_modules/tiddlywiki

It creates a directory structure like this:

[mario:~/test-tw] $ 
-> tree -L 2 -a
.
└── node_modules
    ├── .bin
    └── tiddlywiki

So you see there is a hidden .bin directory 
So if you say

$ which tiddlywiki

it should say:

[mario:~/test-tw] $ 
-> which tiddlywiki
./node_modules/.bin/tiddlywiki

If It says: 

[mario:~] $ 
-> which tiddlywiki
/usr/bin/tiddlywiki

You are using the global version. installed with sudo ... -g option. 
Something is wrong with your user PATH setting.

If you list your paths with echo it should look similar to: 

[mario:~] $ 
-> echo $PATH
./node_modules/.bin:/home/mario/bin: .....

As you see. My path searches for executables in the node_modules/.bin as 
the first directory ...

To do this you need to adjust your .bashrc file in your home directory. 
So add the following lines at the end of your ~/.bashrc  file

# activate local node_modules
export PATH="./node_modules/.bin:$PATH"

If you reopen your terminal window your "echo $PATH" should look similar to 
mine.
now

$ cd test-tw
$ which tiddlywiki

should give you a lokal TW seen above. 
If you go to to any directory that has no node_modules subdirectory and you 
do 

which tiddlywiki ... It should give you the global verison. 

The global version
-----------------------

will be installed with: 

$ sudo npm install tiddlywiki -g

If you are in any directory and call which tiddlywiki it should use the 
global path. 

[mario:~] $ 
-> which tiddlywiki
/usr/bin/tiddlywiki

So you can say eg: 

$ cd ~
$ mkdir test-global-tw
$ cd test-global-tw
$ tiddlywiki mywiki --init server

it should use the global version. __no sudo needed__
try:

$ tiddlywiki --version 
$ wich tiddlywiki

----------------
uninstall the global version

$ sudo npm uninstall -g tiddlywiki

uninstall the local version

$ cd /to/your/path/
$ npm uninstall tiddlywiki


hope this helps
mario

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to