NodeJs: no response to NPM install - node.js

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.

Related

`npx create-react-app my-app` is trying to use the wrong npm

I'm using a MacBook Pro.
I have a fresh install of nvm. I set the node version and it's set to 16.17.0 and npm -v and nix -v both show 8.15.0.
When I run npx create-react-app my-app it fails and the log shows the following...
info using npm#6.5.0
Where is this coming from, and how do I fix it?
I originally installed a number of recent and not-so-recent versions of node.js with Homebrew and I had the exact same error. I completely annihilated every instance of node.js and npm from /usr/bin and /usr/local/bin. There is nothing related in my $PATH, but there must be a reference somewhere.
Well, I played around and discovered that installing version 14.0.0 of node.js plays nicely and my app is now created... but I am now getting...
npm WARN npm npm does not support Node.js v14.0.0
I'm still confounded by the original error because I also tried with 12.0.0 and it tried to work and failed in a nice manner with an error that I could play along with. I'm still baffled by the original error.

Can install but can't run npm packages

I'm having trouble with my node.js/npm setup,
I freshly installed it via the website and it worked fine.
It told me to make sure /usr/local/bin/npm has to be in my path and when I run
echo $PATH it is in there, so it should be fine.
I can now install packages (tested with npm i webpack -save-dev) the installation works as expected, without any errors.
But when i run webpack all It is giving back is command not found has anyone experienced
something like this before?
I believe what you are looking for is a global package install.
Try using
npm i -g webpack
You can get help on install with
npm help i
Did you install node v8/npm v5?
In that case, it seems there's an open big-bug ticket on the npm repository.

I can't install npm not matter what I do

So I'm trying to get myself a good Discord Selfbot and one of them requires nodejs, then it said to do npm install. But it gave me an error. I tried again again again and again but nothing worked. The latest thing I did was installing nodejs via scoop but I get this error trying to install npm. Is there a way to do this manually or something? I've tried installing different versions but nothing. I believe scoop installed the latest version.
Here's the image. (the red squares cover up just names)
You have npm already installed, seems that the problem is you don't have a package.json in that location. It says ENOENT: No such file or directory
You already have npm installed! npm is a package manager for installing nodejs packages. Try running some nonsense command (like "lkajshdflhsf") and you'll see what it looks like if you actually didn't have npm installed. What npm install does is install some package. So, for example, if you want to install a node package called Blah, you would run npm intall blah.

Node.js' npm is installing the wrong package

I'm sorry for not posting the links to every thing I've quoted, stackoverflow won't let me :(
This a relatively bizarre error. I am trying to install the Ghost Blogging Platform in my nodejs project through npm, and the command for that is
npm install ghost
well, instead of installing the Ghost Blogging Platform, it installs this. Which makes no sense at all.
The link I've reffered to is from a node modules website. There, it says that the command I've used was supposed to install this ecto/ghost thing and it links both to the git repository with the Ghost code I've accidentally installed and to the npm page for the Ghost Blogging Platform, which I wanted to install.
I believe this might be a misconfiguration with npm sources. I'm using an Arch Linux and I've installed both node and npm via git clonning the source and compiling it, as seen on this gist.
My npm version is 2.5.1 and my node version is v0.13.0-pre.
Thanks for any help. :)
The Ghost blogging platform is a commercial product, not a normal Node module. You have to fill out the forms on their site for a free trial, and they'll tell you how to install it. How log they let you use it for is up to them.
Please reference their documentation for using it as an NPM Module:
https://github.com/TryGhost/Ghost/wiki/Using-Ghost-as-an-npm-module
Using Ghost as an npm module
Include Ghost as a dependency in your package.json file
"dependencies": {
"ghost": "0.5.2"
}
Run npm install to install Ghost.
Include the Ghost module where desired and then invoke it to get a promise for a ghostServer object.
var ghost = require('ghost');
ghost().then(function (ghostServer) {
ghostServer.start();
});
At this point Ghost should be running!
A quick check reveals these install commands
wget -qO ~/ghost.zip http://ghost.org/zip/ghost-latest.zip
unzip -qo ~/ghost.zip -d ~/ghost
npm install forever -g
cd ~/ghost
npm install --production
as per Ghost Blogging site
just for the next guy who might find this problem.
I really don't know what happened. I solved the problem by uninstalling and reinstalling node and npm in various different ways. Now it works fine.
I was really tired by the time and had tried a lot of times so I really don't remember any details. Sorry :(

NPM appears to do nothing on Linux Mint 15

searched, and did not see this specific problem.
Trying to get a MEAN stack built on my Linux Mint machine, and bumping into a bit of an unusual issue.
Got MongoDB installed, and finally got it running correctly (none of the instructions ANYWHERE mentioned having to create the /data/db/ directory and set permissions, go figure).... it works now.
Got NodeJS installed, and it appears to work correctly.
I had been told (apparently incorrectly) that NPM installs right alongside Node, with:
sudo apt-get install nodejs
but:
$ npm
bash: /usr/bin/npm: No such file or directory
So I go ahead and install NPM separately.
$ sudo apt-get install npm
Seems to work, so far, no errors, and it looks like it is pulling down the NPM package and installing it...
$ nodejs -v
v0.10.21
$ npm -v
$
?? It simply fails to respond without any error... so I try:
$ npm install grunt -g --save-dev
$
Same completely silent failure... in fact, NOTHING I could do gets a response out of NPM.
Looked all over the web, and saw nothing similar anywhere... found out that NPM holds its cache files in ~/.npm and noticed that this folder didn't exist (kinda like the mongo issue above), so I created it, and set permissions to 7777... still nothing.
Purged and re-installed both node and npm, tried installing them both together and separately (yes, desperation)... still no love.
WTF am I doing wrong?
I would love, eventually, to have a nice development environment setup, hopefully with Cloud9 as a local IDE.... but already pulling my hair out.
=========================================================================================
OK, after a few more headaches, this is up and built now... thank you all.
Would love to mark both as answers, but it won't let me.
npm does come with node. Where is apt-get pulling it from? I install the Mac OS X packages on my Mac for development and npm does in fact come with it. I compile from source on my CentOS server and npm comes with it.
Your package provider may be providing them separately as a (in)convenience to you.
As for why your npm command does not work after installation, I can't say for sure, but I am suspicious of your use of --save-dev and -g together.
-g means to install globally, which means 2 things:
It will be installed outside of your npm package's structure into a system location like /usr/bin or /usr/local/bin
It requires root access to install. Did you use sudo to run it with root access?
Both of those requirements conflict with --save-dev which records the package as a dependency in your package.json file so that future npm install commands will install that package within the project space.
That said, I happen to know a lot about grunt. It has 2 parts, a globally installed tool and the package-specific tool. The correct way to install it is:
$ [sudo] npm install -g grunt-cli
$ npm install grunt --save-dev
This will install the grunt-cli package into a system location guaranteed to be in the $PATH, which turns around and looks for a package-specific grunt installed which is not system-wide.
When installing nodejs with npm, this one-liner worked for me.
sudo apt-get install nodejs nodejs-dev npm
I don't believe npm comes with the nodejs installation in the apt repo. Try to install npm separately using the following tutorial http://www.giantflyingsaucer.com/blog/?p=1688 'To install NPM ....'
====== Edit ====
node and npm IS separate. Follow the official wiki and everything should be fine

Resources