node.js install modules still loading without any result - node.js

I just want to install modules in folder on desktop
its still loading forever
in first time its work and install the modules but after thats its never install any modules
npm install express-generator -g
npm install .... I have package in same folder
its still like this see image
I uninstall it and install it again same problem also I uninstall it and download new 32 bit and same problem

i found the answer here
i just use this command
npm config set loglevel info
npm cache add xxx.tgz
http://www.eguidedog.net/doc/what-to-do-when-npm-install-hangs.php

Related

node js npm package installation not completed

I try to install node js npm packages, but It start to install and unfortunately freezes. I also try to install angular packages and it doesn't any problem. please help to fix this issue.
node version is 12.13.1;
npm version is 6.12.1;
I tried to install packages this way
npm i html-to-xlsx
here is a result:
another installation result:
Try the following commands then re-run the command:
npm cache clean --force
npm cache verify
And make sure you are in a place with good internet connection. Sometimes this is the issue.
I found way to fix this issue. I add -g before package name
npm install -g html-to-xlsx
Everything looks good
After that I enter this path C:\Users{USERNAME}\AppData\Roaming\npm\node_modules and copy needful module into my working folder

Error installing Gulp and Bower

I am pretty new to using terminal and installing gulp, but I am running through a few errors. Errors keep popping up and I am not sure why. My goal for right now is to npm install -g gulp and after that npm install -g bower so I get start using Sega Wordpress Started Theme, but not sure if any old files are interfering. Maybe a clean out and reinstall would work? Error is below. Thanks!
npm install -g <package> installs globally, so you need to run with sudo in order to be able to write to the correct destination folders.

Homebrew Install Node Location

Kinda 2 questions related to each other here.
When doing a brew install node, should I first navigate to the root of whatever folder I'm going to hold all my future web projects/apps then run it? Or does it not matter where I run the install initially for Node? Because I notice it creates a node_modules folder in /local/lib/node_modules
I assume it doesn't matter, and when you start installing node packages using npm install [package] it'll create a separate node_modules folder under the context you're in so lets say /www/MyApplication run npm install and it'll create /www/MyApplication/node_modules....and that the one under /local/lib/node_modules just serves as the one for npm itself because it needs its own root node_modules folder which is how npm runs?
Correct, it makes no difference where you run brew install node, it will install into your Homebrew folder.
When you use npm to install a Node module, it will install into the current directory, unless you use the -g global flag. Normally you will install modules that are project dependencies into your project folder, and global modules are for global utilities.
For example, to use Grunt you would install the grunt-cli package globally for the command-line utility.
npm install -g grunt-cli
And for each project that uses Grunt you will install a version of the grunt module for use with the project.
npm install grunt

How do you include npm libraries in a node.js app

I'm trying to create a little app with node-ncurses which I installed over npm install ncurses
with this library install i'm trying to run the examples for node-ncurses from the following
https://github.com/mscdex/node-ncurses/tree/master/examples
But I get path errors with the examples for require('ncurses'), what is wrong?
My ncurses library is install into ~/.npm/ which seems correct to me.
You want to be installing them locally into the same folder of your project. If you miss out the -g flag and just run npm install ncurses within your project directory, you should then be able to run require("ncurses") just fine. All NPM modules installed locally goes into a node_modules folder within your project.
A little further hint, if you install with:
npm install ncurses --save
That will add ncurses to your package.json as a dependency, which means any other dev who might check out your project can run npm install in the project's directory and automatically get ncurses installed as it's listed in package.json as a dependency.
Without the -g flag anything you install with NPM with install into a node_modules folder relative to where you ran the command.
My first recommendation would be to make sure that you are in the working directory of your project and then install ncurses again.
Here is an old, but relevant blog post about how it was designed.

Node Version Manager (NVM) npm installing modules to common folder

I've installed NVM for node.js using the instructions from this post:
http://www.backdrifter.com/2011/02/18/using-nvm-and-npm-to-manage-node-js/
When I switch between node versions and then use npm to install a module, all the modules are placed in the same 'node_modules' folder (~/node_modules/) instead of in the 'node_modules' directory specific to that version of node?
Any idea on how to remedy this?
Based on the comments from https://github.com/creationix/nvm/pull/97:
When installing packages with npm using the global switch -g the
package ends up in the proper directory (i.e.
.nvm/$VERSION/lib/node_modules), however node is unable to require it
since it somehow isn't searching on it's prefix.
So using npm install -g xxxxx will put the modules in the correct location for NVM but if you try to require one of them node can't find the module. I am still playing around with this and will update if I find a solution.
Update
Where does NPM put node_modules? (see https://docs.npmjs.com/files/folders)
Local install (default): puts stuff in ./node_modules of the current package root.
Global install (with -g): puts stuff in /usr/local or wherever node is installed.
Install it locally if you're going to require() it.
Install it globally if you're going to run it on the command line.
If you need both, then install it in both places, or use npm link.
So what I did was run npm init (see http://npmjs.org/doc/init.html) in my projects root dir which generated package.json. Now when I run npm install xxxxx it creates a node_modules dir in my project folder (which I add to my .gitignore). This works for modules that I require in my code.
For commands such as CoffeeScript I install with npm install -g coffee-script which puts it in the correct directory (.nvm/$VERSION/lib/node_modules). While I can't require these modules (npm link should solve this problem) I can run the commands - i.e. coffee.
I just installed express globally (-g) and was having problem when require("express"). Just like Jesse Vogt said I just reinstalled express but this time without the -g just like this: "sudo npm install express" and now is working perfectly!
For latest nvm window version 1.1.7.
Package was installed and placed into the respective nodejs version.
nvm use 16.8.0
npm install truffle
nvm use 16.7.0
npm install mysql

Resources