socket.io installation with npm - node.js

I installed Python 2.7 (had 3.4) and solved one error. Then, I installed Windows 7 SDK, solved another error, but no luck... I read here that I don't have to install Visual Studio as well... Can someone enlighten me with a solution?
The screenshots:

Assure this runs clean prior to your above install
npm install -g node-gyp
Do you have a c compiler installed ?
Are you creating a new nodejs app ? If so then issue this which will prompt you for details then cut a fresh package.json file for you :
npm init

In my opinion Windows is not the best for development , I have so much problems using Windows (and had the same problem), later I've switched to Ubuntu (just learn more Linux and C) - it has so much built-in programs so you don't have to install it by yourself (and you won't have any problems with that little problems and get even more knowledge).

Related

Why npm install speed so slow?

i am using mac book pro - M1 chip and bigsur
but I have a problem.
the speed so slow when i install any library to npm
please click the picture i have counted
the picture, i had install the 'react-native-fast-image'
but there consumes more 1000s for installed
likewise,
i had typed in terminal, 'npm i or yarn install'
Consumes more than 30 minutes.
for solving this, i have tried deleted xcode, and webstrom, and vsc
but, there are no change in speed.
I had this exact same issue. After speaking with Genius Bar we realised I was on an old version 12 of node. Node 15.5 onwards runs natively on M1 so isn't being parsed through Rosetta 2, which was likely causing the lag.
You can check the version of node you're on by running node -v
If you're on anything below 15, if you run nvm install v15 on terminal this might solve your issue by updating your node.
I had an error at this point (you might not) saying:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Which was solved with this.
After sorting that, when running nvm install v15 it solved the lagginess :) good luck!
You might also find even after installing the latest node, your terminal defaults to an old version (mine did to much bemusement!)
You can solve it be setting a default, check this link.
In short, run:
nvm use node
This switches to the latest installed version of node.
Today I used for the first time Node/NPM 17 and I got back to these issues of NPM install taking forever.
I switched back to Node/NPM 14 and everything works again just fine.
For those who cannot move their project to node 15 overnight.
Install node by itself by going on nodejs.org reduce drastically npm library installation on mac book pro - M1 Pro Monterey.

npm-cli.js not found with the CLI command (in Windows 8.1 OS) npm -v

I am trying to install nodejs and npm in my computer with Windows 8.1 - 64 bit. I downloaded the msi from the official nodejs web site and installed it. When I tried to check the version of node by typing node -v, it worked perfectly. But when I tried to check whether npm is installed properly by typing npm -v, the following error appears.
How to fix this.Can someone help me in this. I referred the answers of similar questions here. And this also.But it did not worked too.
This is could because of incorrect installation. Have you tried reinstallation of Node and NPM? If not, uninstall from Program and Features and follow this walkthrough.
Also, need to set npm as global variable $PATH.

Cannot install node.js under Windows 7: "the specified path is too long"

Using the newest node.js installer from https://nodejs.org, I run into the same error every time when it reaches the npm installation. npm 3.x was supposed to deal with this issue, but apparently it doesn't help the node.js installer. The node developers have essentially refused to do anything about it, as this problem has been around for about two years already. Unfortunately, I can't seem to find a work around. How can I get this to install?
I also had this error, trying to install node-v8.10.0-x64.msi on Windows 10.
My solution (to getting it to install; no idea if it won't break further down the line) was changing the install directory from C:/Program Files/nodejs to C:/njs/ (2nd step of current setup process).
I'm surprised those characters made the difference, and that there even is a Windows node release if there's not a proper solution to this (can't believe that maximum path length on Windows isn't modifiable), but this has seemingly worked for me.
I don't think its an installer error, actually windows is restricting the path size to be 150 char.
try reducing the file path name by copying it into direct c or d drive.
Check the link below Microsoft Forum
I've used Choco
It works together with NVM 4 Win.
After once installing node with choco install nodejs
then I install other versions of node using NVM e.g. nvm install 6.9.0
following by choosing that version with nvm use 6.9.0
and then verify with nvm list
and node -v.
I also need to install the latest version installed by choco using nvm install 10.1.0

Can't update from Node v0.10.46 on Mac

I'm having problem's when trying to run my gulp command in the terminal. I've been trying to track down the issue and from what I can tell the issue is that I'm running an outdated version of node.
node -v tells me that I am on v0.10.46, but the Node install downloaded from the website says it's currently on v4.4.7.
The first issue I had was with es6 promises, but I managed to install the es6-polyfill which solved the issue.
Now gulp is throwing an error related to /node_modules/gulp-imagemin/index.js. Specifically the use of const variables. (const path = require('path')).
Based on this thread: https://github.com/sindresorhus/gulp-imagemin/issues/181#issuecomment-219303510 - this issue seems to be an outdated version of node, but no matter what I do it won't upgrade!
I've explored all possible avenues for upgrading Node - using npm, nvm, n, brew and even a local re-install, but everytime it seems to be installing an outdated version.
I've explored the possibility that I'm installing a 32bit version on a 64bit system, but that doesn't seem to be the issue either.
I have absolutely no idea how to progress fixing this issue. I'm trying to build a wordpress website, and no matter what theme I use this error comes back to haunt me!
Help!
EDIT:
Just to add.. in this image (http://imgur.com/a/OzR5Y) you can see the output of me trying to upgrade using N, and then following the David Walsh upgrading method.
I had the same problem and I tried everything from uninstalling it by this instructions without any result. But maybe you have in your computer a management like nvm installed, just try this:
which node
And then if the respond of that is something like:
/Users/MYUSER/.nvm/v0.10.46/bin/node
That's the problem, so you can solve this by uninstalling nvm and then install Node.js normally or just keep using nvm

NPM - Can't install socket.IO

I am trying to install socket.io on windows with npm for use on a nodeJS server.
First, when I typed "npm install socket.IO" i had an error in the log saying something about python and node-gyp. I installed python 2.7.3 and set the environment variables.
Now I got a new error, which has something to do with visual studio (what the hell does VS have to do with npm ? Is it about the compiler? ).
The error is the same as here npm install for some packages (sqlite3, socket.io) fail with error MSB8020 on Windows 7
But when I use the option in the answer instead of the error it tells me something about a possible data loss (c4267) but doesn't log any error.
Then when I start my app, it tells me cannot find module socket.io still
What could this come from ?
Oh and also when i do npm config get root it tells me "undefined" could it have anything to do with it ?
Should I install the modules globally or locally ?
At least one of the packages in Socket.IO's dependency tree is a C/C++ addons which needs to be compiled on your system as it's installed. And, since it's a dependency, if it doesn't succeed in installing, neither will Socket.IO.
To enable cross-system compilation, Node.js uses node-gyp as its build system. You'll need to have it installed as a global package:
npm install -g node-gyp
As well as have its dependencies installed. Abridged version:
Python 2
C/C++ Compiler / Build Tools
For Windows, Microsoft Visual Studio 2013 (C++ or Windows Desktop) (Express edition)
For 64-bit, may need Windows 7 64-bit SDK
Then, you should be able to install Socket.IO as a local package so you can require it:
npm install socket.io
I had a similar problem on Mac.
What resolved my problem is installing a slightly older version of Socket.io.
I did:
npm install socket.io#"~0.8.1"
which would install the latest version between 0.8.0 to 0.8.9, but not 0.9.0 or above.
Socket.io then installed perfectly.
Make sure you have all the required software to run node-gyp:
https://github.com/TooTallNate/node-gyp
You can configure version of Visual Studio used by gyp via an environment variable so you can avoid having to set the --msvs_version=2012 property.
Examples:
set GYP_MSVS_VERSION=2012 for Visual Studio 2012
set GYP_MSVS_VERSION=2013e (the 'e' stands for 'express edition')
For the full list see
- https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294
This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I'm lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.
Feel free to add your vote at:
https://github.com/joyent/node/issues/8005#issuecomment-50545326
The problem causing the compile failure is that the ws module installed by the engine.io module required by socket.io pulls in a backlevel version of nan. See https://github.com/BrowserSync/grunt-browser-sync/issues/95 for details. To work around the problem after the build failure:
cd to node_modules/socket.io/node_modules/engine.io/node_modules/ws
edit package.json to change the release of nan from 1.4.x to 1.6.0
issue command node-gyp rebuild
You should now be able to use socket.io
Another approach is to use Docker for Windows and spin up a NodeJS environment. While developing you can mount your Node code as a Docker volume and so continue to update your code from Windows but execute it and install it's dependencies inside a Linux VM. When you deploy you might prefer to use a Dockerfile that COPY's your Node code into your Docker image and so bakes it into the release image you deploy.
This approach might be required if you don't want to risk changing the socket.io version of your code or its dependencies.
It also may be a valuable solution if you planned to deploy to a corporate Intranet or public/private Cloud.
Docker can also be very handy for testing deployment under different versions of Node without disturbing the development environment of your Windows computer (e.g. for testing a NodeJS lib).
Official NodeJS Docker images
An explanation of how to use these images
this problem makes me very troubled..
I tried many solutions.
I installed .NET Framework 2.0 SDK.
I installed Python 2.7.x
I installed VS 2012 Express
I set some paths
I executed npm install xxx with the argument --msvs_version=2010(or 2012/2013..)...
But all failed.
finally, I uninstalled Python & .NET Framework 2.0 SDK & VS 2012, clear those paths,enable Windows Update, install all essential updates, restart my computer
then execute commands below:
npm install node-gyp -g
npm install socket.io -g
npm install browser-sync -g
there is no errors in installation logs.
Note : this solution may not work for you, but for me

Resources