How to install nodejs modules on windows7? - linux

I tried to install MySQL and Canvas2D modules on windows 7, but there are linux commands at the build instructions, for example make, and there are some shell scripts too. I'm clueless. I have no idea how to install them on windows 7.
Sorry, I'm not an expert programmer, just a beginner, and I just want to try out nodejs with mysql and canvas2d.
Thanks in advance,

Why not install with npm?
NodeJS comes with Node Package Manager, a simple manager that uses repositories on npmjs. It resolves dependencies, and no building is required.
npm install db-mysql
npm install canvas
I also suggest the mysql driver mysql instead of db-mysql.
npm install mysql
I found mysql to be easier to use.
Other commands you might want to know:
npm help
npm install
npm ls
npm update
npm link
npm publish

Getting canvas to work on Windows is generally difficult (you need to install Python, Visual Studio Express + hotfixes etc). PhantomJs works easily on Windows, but little support for mysql afaik.

Related

TFS cross platform CLI tfx-cli offline installation

I want to install tfx-cli on a machine which does not have access to Internet.
I have installed nodejs with node-v6.4.0-x64.msi.
Per msdn guide after installing node.js install tfx-cli with below command
npm install -g tfx-cli
But the above requires internet connection.
How to install tfx-cli in a machine which has no internet access.
Since you are using nodejs-v6.4.0. Afraid there is no way to install without internet access.
Certainly, there are some ways to use npm for offline pack installation. Such as offline-npm However it's not suitable for your case:
npm >= v3.x bundled with node >= v5 has broken this project.
preinstall script is since then called after requests to npm registry
are made. This makes it impossible for offline-npm to start as a
registry server.
And Use local-npm for offline NPM package installation, however you still should install many other things from internet. It doesn't make sense. If you have internet, you could directly install it.

Do I have to learn node.js in order to use npm?

I need to use a package on npm, so I'm trying to learn how to use npm. The tutorials are fine, but I feel like they're assuming I know node.js, which I don't, and I'm having a hard time finding a tutorial for npm that doesn't also assume I know node.js. Do I need to learn node.js to use npm?
you don't need to know anything about node to use npm, its just a package manager. Install npm and then npm install all the packages you want. You will need to learn the npm toolchain, however, and it also helps to know which options are available for the various commands.
At the very least you should know the difference between installing a package globally and installing a package locally, i.e npm install -g vs. npm install respectively.

NPM Experts! Does NPM need to be installed with every JointsWP Gulp Sass project

I'm using JointsWP (an excellent Foundation 6 port to Wordpress).
I'm using the Sass version and it's working great. However, I seem to have to install npm with every project. Is this nessesary?
Is there a way to install npm globally and link to it from my project? Or have the project find it automatically?
I think you are confused about what the command npm install actually does. npm install installs all the npm dependencies for your project into the node_modules directory. It doesn't actually install npm. To run npm install you have to have Node.js installed (npm is included with node).
So to answer your question, yes it is necessary to run npm install for every project.
Relevant Article: Global vs Local installation
The article above shared by Colin Marshall is great and sums up the answer perfectly.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project. If you’re installing something that you want to use in
your shell, on the command line or something, install it globally, so
that its binaries end up in your PATH environment variable.
So to answer your question, is it possible? Yes.
Is it recommended? No.
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
You can install gulp sass globally with the command:
npm install -g gulp-sass

npm path and installation issues - suggestions

I have used to install my nodejs on D:\ drive instead of C and have set environment variables to D drive node & npm folders.
Then i changed npm installation path as "prefix=D:\node\node_modules\npm
" on "npmrc" file. So i could confirm that all user based modules are pointing on D drive npm folder instead of appdata.
I tried to install express js globally and i used to check the package tree on my cli as mentioned below,
npm ll -g
while trying this command am getting npm extraneous ERR,
Please suggest me that which way i have to use npm path and installation stuffs.
Thanks in advance.
It might seem like a good idea to install packages globally, but this is one great reason not to.
Often used packages like express, and cookies should be kept local to a package. Mostly because of versioning issues. You might have one package using express2, but your new one wants to use express3. You would have trouble if it was a global install. When in doubt leave off that -g, and use a --save instead. (This adds the package to your npm dependencies list.)
On the other hand, command line tools like mocha, yeoman, and uh not much else that I know of should be installed with the -g flag.
I'm not much of a windows person, so you'll have to look a little yourself, but I would also recommend not installing Node by hand, but instead using a version manager like nvm to do that stuff. Here's an nvm port for windows: https://github.com/coreybutler/nvm-windows

NodeJs: no response to NPM install

I'm trying to install the express framework for node.js. However, whenever i run "sudo npm install express", i never get a response. It just sits there. Im seriously frustrated at this point.
Using npm 1.0.22 on OSX Lion
I had this issue on lion as well. It was because Lion removed xcode from my path and at some point, the express install triggered gcc.
Try this to pinpoint your problem, it will turn on verbose npm output and is a great way to debug npm packages:
npm config set loglevel info
If your problem does turn out to be a lack of gcc, first see if it's already installed in: /Developer/usr/bin and if not, use the 'app store' to reinstall.
Here's more info on the gcc issue: http://www.quora.com/What-is-the-path-for-gcc-in-Mac-OS-X-Lion
You may be running node v0.5.5-pre which doesn't fall within the required version numbers for the npm package. I found some "answers" here.
To fix I downloaded the 0.4.11 tar.gz from the node.js main page and did a manual build/install: (./configure ; sudo make install) and ran npm install express again, which worked fine this time.

Resources