Vue CLI SOCKET_TIMEOUT error creating new project (npm error) - node.js

So basically I am trying to set up a new Vue project using vue create vue-first-app and I end up with this error below. I tried to increase the timeout using npm install -timeout=9999999 . I also tried cleaning the npm cashe with npm cache clean --force but it did not help. Does anyone know a way to solve this?
Vue CLI v4.5.9
✨ Creating project in /home/marius/vue/vue-first-app.
🗃 Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/mkdirp failed, reason: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! /home/marius/.npm/_logs/2020-12-14T09_54_21_447Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps

Try
Either:
sudo npm cache clean -f
npm update
npm update -g #vue/cli
vue create vue-first-app
OR
Point the npm registry url to http :
npm config set registry="http://registry.npmjs.org/"
And then re-run your vue cli command :
vue create vue-first-app

This may help you.
Check if you have a working internet connection (check if the firewall is not blocking the connection request)
Try to go the npm config file and change the time out from there. This issue is commonly caused when one of these two reasons occur. Path: installationDirectory\nodejs\node_modules\npm and open the .npmrc file and try changing the time out from there.
Also refer: https://docs.npmjs.com/common-errors

Had the same problem.
For me, using sudo worked.
sudo vue create vue-first-app
Good luck!

I had a similar problem, for me it worked changing the useTaobaoRegistry to false in the config .vuerc, it should be located on C:/User/your_name/
{
"packageManager": "npm",
"useTaobaoRegistry": false
}
Thanks to fangbinwei for the solution:
https://github.com/vuejs/vue-cli/issues/6003#issuecomment-716158880

Related

npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! network Socket timeout

This the error:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
I have running: -npm cache clean --force
Deleted node_modules and lock-package.json and run npm install but still got me that error
Try this answer
or run npm i -g npm#8.5.1
i think it's an issue with npm version , 8.5.1 solves the problem in most cases
basically try earlier versions and i think the problem will be solved
I faced this error some days ago. I changed the timeout and it works for me. (Note: my npm version is 8.19.1)
You can try this solution with other npm versions as well.
First of all, check the current settings. For checking the current settings run npm config ls -l or grep fetch
Then, check these 4 values (fetch-retries, fetch-retry-factor, fetch-retry-maxtimeout, fetch-retry-mintimeout, fetch-timeout)
$ npm config ls -l | grep fetch
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000
For changing the time out, Run these two commands-
npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000
I faced this problem recently. I tried many solutions like npm cache verify, npm cache clean --force, npm config set fetch-retry-mintimeout, npm config set fetch-retry-maxtimeout, deleting package-lock.json, using different version of npm and/or node.
But the solution that worked for me was to switch to yarn.
I solved this by setting a timeout of 60000 for npm in the .npmrc file. To do that from your terminal, simply do the following:
$ nano .npmrc from your work directory if you want a configuration locally.
Add timeout=60000, save and you're good to go.
Originally posted here: https://github.com/facebook/create-react-app/issues/10251
You can resolve this using YARN package manager. yarn create react-app my-app
hope it help.
I am not sure if this will help anyone else, but what appears to have worked for me was dropping my company's VPN connection and reestablishing it!
In my scenario, it was the yarn.lock file availability. So the installer tried to fetch dependencies and threw an error since the response time was delayed. So deleted both yarn.lock and package.lock file and reinstalled after setting npm to npm#8.5.1
I found solution for it, which works great for me
1.npm config set registry http://registry.npmjs.org/
2.npm i or npm i --save --legacy-peer-deps
Try removing proxy settings by running the commands below:
$ npm config rm proxy
$ npm config rm https-proxy
mine worked using these steps, hope it works for you too.
npm cache clean --force
npm uninstall -g create-react-app
npm uninstall create-react-app
and then
npx create-react-app project-app
if it does not then probably your internet connection is poor or there is a proxy set up error. let me know if it does not work.

Error while installing firebase with npm - ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC

I am trying to install firebase but no matter what I do I keep getting this Error:
npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! errno ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/#firebase%2Fapp: 39732:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
I get this error after running npm i firebase or npm i --save firebase. It doesn't happen when I install any other package
I have tried all sorts of commands like npm cache clear --force, npm config set strict-ssl false, npm config set registry http://registry.npmjs.org, no combination of them seams to fix it.
I am using npm version 8.5.4 and node version v16.14.0
When I run npm config get cafile it outputs null
I tried searching for what a certificate means without any success.
Any help is greatly appreciated
If you are using windows, search "services" in the start menu, then check the "OpenSSH Authentication Agent" service. If the startup type is "disabled", select "automatic (delayed startup)". then restart the computer and try to install firebase. this solved my problem.
please try this command : npm i --save firebase -d it helped me.

Error while trying to create react app using npm

I'm trying to creating react app using create-react-app command but I get this error message:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/dotenv-expand: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\IMAD\AppData\Local\npm-cache\_logs\2022-02-12T18_27_46_293Z-debug-0.log
I tried to clean cache:
npm cache clean -f
I also tried restarting the computer and reinstall nodejs and npm, but nothing was fixed.
Can anyone know what is the issue? and how can I solve it?
You should use npx command (not npm) like that as in official documentation : https://reactjs.org/docs/create-a-new-react-app.html
npx create-react-app my-app
After more than 3 days of working on this error, I found the solution and fixed the problem by install another version of Nodejs.
The current version was v16.14.0 when I got this error. And now it's v16.0.0 and everything's is work just fine.
New versions of nodejs are not stable, downgrade to 16.0.0 was the better thing i made.
I solved this using the following command.
npm uninstall -g create-react-app
then
npm install -g create-react-app

Strapi with MongoDB (macOS): error while creating the project with the command "npx create-strapi-app my-project"?

I am trying to create a Strapi application with MongoDB and I am following the docs on the website, but when configuring the connection, I get this error and I am not understanding why.
Error I get everytime (screenshot)
Log's error (screenshot)
Error:
"Connection test failed: Command failed: npm install --prefix /var/folders/gb/519s_wwn1ps0c0skqw7_03140000gn/T/strapi40136a8b0f29 strapi-connector-mongoose#3.5.4
npm ERR! Cannot read property 'spec' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/red/.npm/_logs/2021-04-08T09_37_12_689Z-debug.log"
MongoDB was installed using Brew and is running as a service.
Node version is 14.16.1.
NPM version is 7.8.0.
Never had a problem like this before with any sort of package or similar.
I already tried to: uninstall MongoDB and reinstall it, reinstall Node and npm.
When I run npm install -g npm-reinstall I get this instead and I think it is related to the problem:
Error screenshot
What I need to fix this?
I fixed this issue by changing the registry of npm config.
npm config set registry https://registry.npmjs.org/
I had to downgrade npm to its previous version to avoid this error.
npm install -g npm#6

Node error npm ERR! cb() never called

When I am running the command npm install npm#latest -g
I am getting below error :-
npm WARN tar zlib error: unexpected end of file
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dk\AppData\Roaming\npm-cache\_logs\2018-04-10T03_25_52_880Z-debug.log
i googled it and tried so many things,nothing worked.
To anyone stumbling upon this question, if you are facing the same error message on npm install, then npm install --no-package-lock solved it for me.
As suggested in the referenced Github issue in Mohit Mutha's comment above, this is especially true if the command is ran in a CI/CD pipeline, or in my case, in Docker.
EDIT: Reason being is that the package-lock.json file already exists in your Docker image or CI pipeline
Full details
Our team encountered this error in our CI pipeline. However, the top answer of using --no-package-lock actually causes npm to also not use a present package-lock.json, which is definitely not the desired behavior for CI. Instead, using npm ci is now the recommended way to install in CI since it will use the existing package-lock (and nothing else).
Solved by running
sudo npm cache clean --force
and after that deleting package-lock.json and node_modules
and then performing
npm install
FYI I have gone through DOZENS of these responses for the exact same ask posted here again and again in SO. I think most of responses are valid. But in my case the actual issue was the CORPORATE PROXY not npm itself.
In my Dockerifle I had to explicitly add http-proxy and https-proxy to my npm config prior to running the npm install and it worked. FYI you need to tell npm config about your proxy or it wont download dependencies and this is what was throwing the cb() never called error - this works in both local (terminal) and docker containers.
...
RUN npm config set http-proxy http://mycompanyproxy.mycompany.com:8099
RUN npm config set https-proxy http://mycompanyproxy.mycompany.com:8099
RUN npm install
EXPOSE 3000
CMD ["node", "server"]

Resources