Install Stylus manually from .zip file - node.js

i have a problem installing stylus through npm install because of the proxy settings of my network. I want to know how to install stylus manually with the .zip file that i just downloaded from their github.

Well, you should put all content of this archive in $NODE_PATH/stylus folder:
cd $NODE_PATH
mkdir stylus
cd stylus
<copy all here>
Then you should symlink bin/stylus from this folder to some dir in your PATH variable, for example /usr/local/bin/ (if you on Linux or OS X):
ln -s bin/stylus /usr/local/bin/stylus
That's all.
P.S.: You can configure npm to use proxy. See http://jjasonclark.com/how-to-setup-node-behind-web-proxy for detail information.

Related

npm webpack: coomand not found

I'm running this command on linux:
sudo npm install -g webpack
I'm getting the following output:
/home/igor/.npm-global/bin/webpack ->
/home/igor/.npm-global/lib/node_modules/webpack/bin/webpack.js
/home/igor/.npm-global/lib └── webpack#1.13.3
which looks perfectly legit, but when I try to use:
webpack -h
I get the
webpack: command not found
How can I make webpack running from the command prompt?
The default directory for globally installed NPM modules is /usr/local, which will install the module binaries inside bin folder.
If you echo your $PATH environment variable you'll see that /usr/local/bin is in your path. That means when you run a command like webpack, macOS will try to find the binary in this folder or any other folder on your $PATH.
At some point you probably changed it to ~/.npm-global, which installed webpack binary into your /home/igor/.npm-global/bin/. As this folder is not in you $PATH, macOS did not find it. You can run npm config get prefix to confirm this.
Solution 1 is to add it to your path by changing your ~/.profile file. Just append export PATH=~/.npm-global/bin:$PATH to it and restart your terminal.
Solution 2 is to change back the default folder to /usr/local by running npm config set prefix '/usr/local'. In this case you won't need to change your PATH variable.
Try to install webpack localy on the path you're working with.

write module: npm install missing dist css files

I'm writting a small module
now install it somewhere
cd /tmp
npm install git://xxxx/GongT/mymdl.git
install complete successfull
but file "global.css" gone from node_modules/mymdl/dist/ folder.
I'm sure that file node_modules/mymdl/dist/global.css is in my git repo
whats happend here?

How to run a node.js app from name

How do you create a console app that you can run by a name instead of using node and a .js file to start the app?
Instead of...
$ node myapp.js --out ./folder/
Can I...
$ myapp --out ./folder/
You can use the bin option in your package.json file to make your script executable. From the documentation for package.json:
A lot of packages have one or more executable files that they'd like
to install into the PATH. npm makes this pretty easy (in fact, it uses
this feature to install the "npm" executable.)
To use this, supply a bin field in your package.json which is a map of
command name to local file name. On install, npm will symlink that
file into prefix/bin for global installs, or ./node_modules/.bin/ for
local installs.
Click the link and search for bin: https://www.npmjs.org/doc/json.html for more info.

npm installing executable in usr/local/share/npm/bin rather than usr/local/bin

For example I tried installing npm serve globally
$ npm install -g serve
but after seemingly successfully installing it, I was unable to run the serve executable. Seems like the command just could not be found. Turns out the exe serve file was located in:
usr/local/share/npm/bin
rather than in what I thought should be (where all the other executable files are):
usr/local/bin
Any idea why I can't seem to get this to work?
Similar to this answer, create/edit ~/.npmrc to include:
prefix = /usr/local/bin

What is the npm tmp directory? Can I delete it?

On a brand new Ubuntu machine 12.04.3 I did the following installations on my home directory:
Git: sudo apt-get install git
Node.js: sudo apt-get install nodejs and updated it with sudo npm cache clean -f, sudo npm install -g n, sudo n stable
npm: sudo apt-get install npm and then updated it with npm update npm -g
Yoeman: sudo npm install -g yo
A new "tmp" directory popped up in my home directory with the following structure:
npm-13728-uErqEQ4O:
1392566713336-0.9297236264683306 1392566726706-0.4921755278483033
npm-13763-yoMEDYdC:
1392566864990-0.09957328205928206
Each of the uErqEQ4O subdirectories contain:
tmp.tgz
package:
AUTHORS configure html make.bat node_modules scripts
bin CONTRIBUTING.md lib Makefile package.json test
cli.js doc LICENSE man README.md
The yoMEDYdC subdirectory contains:
tmp.tgz
package:
cli.js package.json readme.md scripts yeoman.txt yoyo.js
What is this tmp npm directory and everything inside it? Why was it generated?
Can I delete it? If not, where can I move it to because I don't want it in my home directory?
Tmp or temp generally means some kind of temporary storage, which is auto generated by program (mostly per one session):
Here is what the npm tmp directory is:
Temporary files are stored by default in the folder specified by the
tmp config, which defaults to the TMPDIR, TMP, or TEMP environment
variables, or /tmp on Unix and c:\windows\temp on Windows.
Temp files are given a unique folder under this root for each run of
the program, and are deleted upon successful exit.
If you are not sure can you delete it, just add some prefix to it e.g. _tmp and try to run you app. If it runs with prefix then you can delete it. If not, then you app has some kind of reference to it.

Resources