I am getting an error while creating a react app [duplicate] - node.js

Whenever I try to run npx create-react-app my-app, it shows the error:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#types/eslint/-/eslint-8.4.4.tgz - Not found
npm ERR! 404
npm ERR! 404 '#types/eslint#http://registry.npmjs.org/#types/eslint/-/eslint-8.4.4.tgz' is not in this registry.
When I try like eslint-8.4.0.tgz I can download it but 8.4.4 just doesn't exist.

There is an issue with v.8.4.4 on the NPM
Change your package.json and use 8.4.3 instead!
Pin it in "resolutions" for yarn
"resolutions": {
"#types/eslint": "8.4.3"
}
or "overrides" for npm
"overrides": {
"#types/eslint": "8.4.3"
}
more info about overriding values in NPM:
How do I override nested NPM dependency versions?
more about issue (check it here):

It is not a problem of React, but a problem of a package #types/eslint. Seems like the bad version of the package was upgraded and it's not downloadable.
To solve the issue, you may want to create a react app, without using create-react-app. To do this, try to use the following tutorial
Or you can wait until the package is fixed.

Related

Every time I try creating react app it failsand get error 404 not found GET https://registry.npmjs.org [duplicate]

Whenever I try to run npx create-react-app my-app, it shows the error:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#types/eslint/-/eslint-8.4.4.tgz - Not found
npm ERR! 404
npm ERR! 404 '#types/eslint#http://registry.npmjs.org/#types/eslint/-/eslint-8.4.4.tgz' is not in this registry.
When I try like eslint-8.4.0.tgz I can download it but 8.4.4 just doesn't exist.
There is an issue with v.8.4.4 on the NPM
Change your package.json and use 8.4.3 instead!
Pin it in "resolutions" for yarn
"resolutions": {
"#types/eslint": "8.4.3"
}
or "overrides" for npm
"overrides": {
"#types/eslint": "8.4.3"
}
more info about overriding values in NPM:
How do I override nested NPM dependency versions?
more about issue (check it here):
It is not a problem of React, but a problem of a package #types/eslint. Seems like the bad version of the package was upgraded and it's not downloadable.
To solve the issue, you may want to create a react app, without using create-react-app. To do this, try to use the following tutorial
Or you can wait until the package is fixed.

npm ERR! must provide string spec

I'm having this error since a while, in this case, the problem occur executing the following command.
npx create-react-app my-app
Actually, it happens with any npm commands as well, I tried deleting package.json, changing npm versions and yet didn't work, so I'm here asking for help.
This is the entire error:
C:\Users\c>npm install
npm ERR! must provide string spec
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\c\AppData\Local\npm-cache\_logs\2022-01-28T16_50_23_009Z-debug.log
Version of npm and node:
node --version
v16.13.2
npm --version
8.3.2
I had the same issue, it was a missing version in my package.json
look like mistakenly I removed some text
"dependencies":{
"angular/cli" :"{}"
}
try to update your npm: npm upgrade
then: npm clean cache
Following, i'm in the exact same position. Tried changing the NodeJS version using NVM and now some of the commands work (npm -v shows im running 8.1.0) but npm update and npm/npx create-react-app give me an " ERR! must provide string spec " !
I faced this same issue yesterday.
This is what I did to resolve it:
Uninstalling node entirely and removing node_modules and package.lock.json from the project directory.
Install node afresh and run npm install in your project directory.
I tried to reactivate an old project which had packages noted down differently then usual in package.json. They had an id and locator parameter, like:
"ImagePicker": {
"id": "ImagePicker",
"locator": "https://github.com/dhavalsoni2001/ImagePicker.git"
}
After removing / replacing them by version numbes, i could install.

How to abstract next/image from next.js

I'm only using the next/image from Next.js. Is there a way to only install next/image module and not the entire Next.js module. I tried doing the following -
"next/image": "^10.0.5",
"next/link": "^10.0.5",
But after doing npm install I'm getting the following error -
$ npm install
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "next/image": name can only contain URL-friendly characters
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sugamxp\AppData\Roaming\npm-cache\_logs\2021-02-17T06_08_55_518Z-debug.log
There is no such package next/image, it is just a folder inside next package, so no, you cannot install it separately.
Moreover, you can't use it separately without NextJs because it relies on NextJs server to optimize images on demand. I guess, you would need to find another solution if you want image optimization.

Vue CLI SOCKET_TIMEOUT error creating new project (npm error)

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

Why am I getting error "No valid versions available for undefined" while installing create-react-app

I'm trying to install React through command prompt. NodeJS is already installed.
When I try to run this command:
npm i -g create-react-app
It is displaying error as shown below:
npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xyz\AppData\Roaming\npm-cache\_logs\2019-12-10T10_51_39_2222-debug.log
Sometimes this can happen when you are using a private NPM registry / proxy registry and it has corrupted metadata. I've seen this happen with Sonatype Nexus 3 - there were corresponding error messages in the server logs.
Are you sure you have the right Node version? Try updating NodeJS or try running: npx create-react-app my-app
you should check this out issue.
If the problem still exist, please check your versions with this:
npm -v
node -v
For me this error came up because I had a version number that did not exist for a package I wanted.

Resources