How to execute 'coffee' command after installation? - node.js

I installed coffee-script as per directions.
$ npm install http://github.com/jashkenas/coffee-script/tarball/master
npm http GET http://github.com/jashkenas/coffee-script/tarball/master
npm http 200 http://github.com/jashkenas/coffee-script/tarball/master
npm http GET https://registry.npmjs.org/mkdirp
npm http 200 https://registry.npmjs.org/mkdirp
npm WARN package.json cookie-signature#1.0.0 No repository field.
npm WARN package.json fresh#0.1.0 No repository field.
npm WARN package.json methods#0.0.1 No repository field.
npm WARN package.json range-parser#0.0.4 No repository field.
npm WARN package.json send#0.1.0 No repository field.
npm WARN package.json ms#0.1.0 No repository field.
npm WARN package.json pause#0.0.1 No repository field.
npm WARN package.json bytes#0.2.0 No repository field.
npm WARN package.json formidable#1.0.11 No repository field.
npm WARN package.json css#1.0.8 No repository field.
npm WARN package.json uglify-js#2.2.5 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json walk#2.2.1 No repository field.
npm WARN package.json css-parse#1.0.4 No repository field.
npm WARN package.json css-stringify#1.0.5 No repository field.
coffee-script#1.6.3 node_modules/coffee-script
└── mkdirp#0.3.5
yet when i execute 'coffee' command i get
$ coffee
-bash: coffee: command not found
What am i doing wrong?
PS: i am doing this on Mac Terminal
EDIT: -
Same problem is occurs when i install nodemon the npm install takes place similar to above. But when i input a nodemon command on $ prompt it says -bash: nodemon: command not found

I installed coffeescript on my mac yeasterday as a matter of fact. Here is how I did it:
First of all, go install NodeJS.
Then go in Terminal and type the following: sudo npm install -g coffee-script
That's it - If you type in coffee in Terminal, it should start without a problem

Anything you want to run as a command (nodemon, coffee, node-inspector) must be installed with npm install -g the-package-name. If you use npm install it just puts it into your local node_modules directory and won't create the symlink for command line execution.
If you find that you need to use sudo, you might want to read this blog post: http://howtonode.org/introduction-to-npm:
what, no sudo?
I strongly encourage you not to do package management
with sudo! Packages can run arbitrary scripts, which makes sudoing a
package manager command as safe as a chainsaw haircut. Sure, it's fast
and definitely going to cut through any obstacles, but you might
actually want that obstacle to stay there.
I recommend doing this once instead:
sudo chown -R $USER /usr/local

Related

npm install suddenly fails

I have been able to install node modules locally in a project for quite some time. All of sudden ALL attempts at installation fail, with the same type of error:
Homers-MacBook-Pro:test homer$ npm install bootstrap#3
/Users/homer
└── bootstrap#3.3.7
npm WARN enoent ENOENT: no such file or directory, open '/Users/homer/package.json'
npm WARN homer No description
npm WARN homer No repository field.
npm WARN homer No README data
npm WARN homer No license field.
I'm not using a package.json file, just hoping to install some modules in a local node-modules directory. I don't understand why npm suddenly thinks it needs a package,json in my Home directory.
I'm on MacOS 10.12.4. There have been no upgrades in the system or in Node since the last successful npm install a couple of weeks ago.
This is just a warning, not errorwhich means you can ignore it. And your package has been successfully installed.
npm WARN homer No description // no description in package.json
npm WARN homer No repository field. // no repository setted in package.json
npm WARN homer No README data // no introcude md found
npm WARN homer No license field. // no lisence type setted in package.json
Above warn messages is all about details of package.json which were caused by package.json not found.
package.json is a config file which stores libraries that you installed by npm. So that you don't have to copy/manage these libraries manually and locally.
Next time for a new environment, you can simply reprocude the denpendencies by npm install, and npm will read your package.json and reinstall packages stored in it.
As commented by #peteb (thanks again), while install packages via npm install [packages], npm will try to check whether your newly installed package is listed in package.json . If the file doesn't exist, then this warn message will be shown.

Unable to install watchify package

I am trying to install watchify package via npm but I am failing. After a little while the command just stops its execution. Any idea on how to fix this issue? Thx
npm install --save watchify#2.4.0
npm WARN package.json thumbnail-gulp#1.0.0 No description
npm WARN package.json thumbnail-gulp#1.0.0 No repository field.
npm WARN package.json thumbnail-gulp#1.0.0 No README data
> fsevents#0.3.8 install /Users/sandropalmieri/Documents/mycode/reactjs/thumbnail-gulp/node_modules/watchify/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

Error when upgrading Node.js via npm

Following the instructions at http://davidwalsh.name/upgrade-nodejs, to upgrade Node.js on a RedHat Fedora 16 server, I get the error...
cp: cannot overwrite directory `/usr/local/bin/node' with non-directory
... and the version of node remains unchanged.
node --version
v0.10.12
# sudo npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
# sudo npm install -g n
npm http GET https://registry.npmjs.org/n
npm http 200 https://registry.npmjs.org/n
npm http GET https://registry.npmjs.org/n/-/n-2.0.2.tgz
npm http 200 https://registry.npmjs.org/n/-/n-2.0.2.tgz
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
npm WARN package.json fresh#0.1.0 No repository field.
npm WARN package.json methods#0.0.1 No repository field.
npm WARN package.json range-parser#0.0.4 No repository field.
npm WARN package.json send#0.1.0 No repository field.
npm WARN package.json cookie-signature#1.0.1 No repository field.
npm WARN package.json bytes#0.2.0 No repository field.
npm WARN package.json pause#0.0.1 No repository field.
npm WARN package.json eyes#0.1.8 No repository field.
npm WARN package.json eventemitter2#0.4.11 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
n#2.0.2 /usr/lib/node_modules/n
# sudo n stable
install : node-v0.12.7
mkdir : /usr/local/n/versions/node/0.12.7
fetch : https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz
cp: cannot overwrite directory `/usr/local/bin/node' with non-directory
installed : v0.10.12
This is just on a test server, so there is no danger of disrupting the existing node service. What would be a simple way to get node to upgrade to 0.12.7?
EDIT: My solution was to rename /usr/local/bin/node then run taaem's node-install.sh script. When Node.js 0.12.7 was successfully installed, I could delete the original (renamed) directory.
Run the following commands which will upgrade the node version.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
The n package represents a Node helper, and running the last command upgrades node to the latest stable version.
Once your install is complete, you can confirm you version with another command
sudo n 0.8.21

npm list not returning package paths

npm has started to seriously under perform recently, I have attempted to re install ghost a number of times but since installing it to its current location npm cant find its path.
I enter the below from /home/usr
$ npm list ghost --parseable
$ npm list express --parseable
$
and again in /node_modules I then get the below.
pi#raspberrypi://home/pi/node_modules$ npm list ghost --parseable
npm WARN package.json has-binary-data#0.1.1 No repository field.
npm WARN package.json socket.io-adapter#0.2.0 No repository field.
npm WARN package.json debug#0.6.0 No repository field.
npm WARN package.json bind#0.0.1 No repository field.
npm WARN package.json emitter#1.0.1 No repository field.
npm WARN package.json indexof#0.0.1 No repository field.
npm WARN package.json object-component#0.0.3 No repository field.
npm WARN package.json parseuri#0.0.2 No repository field.
npm WARN package.json parsejson#0.0.1 No repository field.
npm WARN package.json parseqs#0.0.2 No repository field.
npm WARN package.json better-assert#1.0.0 No repository field.
npm WARN package.json callsite#1.0.0 No repository field.
Am I right in thinking npm has lost the path to the above package.json files?

Error in configuring/installation of nodemon

I'm new to nodejs, I am having difficulties in setting up nodemon. I tried to install nodemon using the below command
npm install -g nodemon
But I get the below error,
npm WARN package.json methods#0.0.1 No repository field.
npm WARN package.json bytes#0.2.0 No repository field.
npm WARN package.json pause#0.0.1 No repository field.
npm WARN package.json send#0.1.0 No repository field.
npm WARN package.json range-parser#0.0.4 No repository field.
npm WARN package.json cookie-signature#1.0.1 No repository field.
npm WARN package.json fresh#0.1.0 No repository field.
How to solve this? And How do I configure nodemon to monitor changes to my files?
The messages you're getting are just warnings emitted by npm to warn that the installed package.json has no repository specified. This behavior of npm is quite new. See this github issue.
The good news is, you have nodemon installed successfully and you do not need to configure it but start it with some command line options. See the nodemon page for more information.
A simple usage example is
nodemon --watch routes app.js
Which starts app.js and watches the routes directory for changes.

Resources