create-react-app not working 'A template was not provided' - node.js

Hi there I'm having some problem with create-react-app:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
npm WARN deprecated svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
added 1376 packages, and audited 1377 packages in 22m
181 packages are looking for funding
run npm fund for details
6 moderate severity vulnerabilities
To address all issues, run:
npm audit fix
Run npm audit for details.
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have tried the recomendation steps from the create-react-app official website:
npm uninstall -g create-react-app - This didn't work.
I have clear the npm cache, also didn't work.
I have search with 'where create-react-app' so I can delete it, and it didn't fine anything.
Can anybody help me with this problem? Thank you very much.

The solution I found, after trying lots similar answers was the following:
npm uninstall -g create-react-app
npm cache clean --force
npx create-react-app#latest your-app-name
Notice the "#latest" create-react-app.
Hope it helps

Related

Not able to install react-router-dom

Can anyone please tell me why react- router- dom is not installing in my vs-code and how to fix it.
It showing 6 high vulnerability, I also run npm audit fix --force and npm audit but nothing happened.
Please tell me how to remove these vulnerability
Just tried it, react-router-dom installs and also works on your part as I can see.
Try to fix the vulnerabilities by doing these steps:
npm outdated // run to check outdated npm packages
npx npm-check-updates -u // run to check updates outdated npm packages
npm install // run to update npm packages
Source: https://stackoverflow.com/a/70920497/12772716

npm install not installing any package

Whenever I run the command npm install package-name, it doesn't show any error and it also does not install the package(no node_modules folder, just does nothing). Here is the kind of message I get:
up to date, audited 248 packages in 11s
8 packages are looking for funding run npm fund for details
19 vulnerabilities (6 moderate, 9 high, 4 critical)
To address issues that do not require attention, run: npm audit fix
To address all issues (including breaking changes), run: npm audit
fix --force
Run npm audit for details.
I have also tried npm i package-name and npm install --save package-name, but all give the same message. I'm currently using Node version 18.12.1.
What could I be doing wrong and what could be causing this issue?
In order to install npm packages locally, you should run the
npm init
command first.
A file called package.json will be created which contains basic information about the project and the dependencies used in it.
Then in the same directory run the installation command.
Silly me. The fix was to initialize npm in the folder. I ran npm init -y and everything works fine now.

error when I setting up REACT environment

I'm trying to install react native on my Mac through the terminal using "sudo npm install -g expo-cli" but at the end of the installation errors appear.
115 packages are looking for funding
run `npm fund` for details
31 vulnerabilities (19 moderate, 12 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Before trying to install react native I obviously installed nodeJS (16) in its latest version.
Anyone have an idea why the installation doesn't work?
when I do "npm audit fix" this is what it says:
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
Thank you in advance for your help.
Good news!
The first block you're referring to does not indicate installation failure. Your packages were installed correctly. The warnings are for nested security vulnerabilities which you can choose to address or ignore, depending on your app.
To prove that it was installed, run npm list -g in your terminal and see if expo-cli is in the list.
You can also check the packages installed correctly by creating a new react app using
npx create-react-app my-app
cd my-app
npm start
npm audit fix is intended to automatically upgrade / fix vulnerabilities in npm packages

npm packages have been updated, but still detects deprecated packages and gatsby-cli doesn't work

While attempting to learn Gatsby, I have run into some depreciated package errors as follows when installing the gatsby-cli package:
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN express-graphql#0.9.0 requires a peer of graphql#^14.4.1 but none is installed. You must install peer dependencies yourself.
Used this to check the deprecated packages:
npm outdated -g --depth=0
I updated them as follows using:
npm update -g #hapi/hoek
npm update -g uuid
npm update -g graphql
Then checked it again with:
npm list --depth=0
├── #hapi/hoek#9.2.0
├── graphql#15.5.1
└── uuid#8.3.2
These are the latest versions:
https://www.npmjs.com/package/#hapi/hoek?activeTab=versions
https://www.npmjs.com/package/graphql?activeTab=versions
https://www.npmjs.com/package/uuid?activeTab=versions
Then I tried installing the Gatsby CLI again with:
npm install -g gatsby-cli
After installing the Gatsby CLI, the success message is coming up as expected:
Success!
Welcome to the Gatsby CLI! Please visit https://www.gatsbyjs.org/docs/gatsby-cli/ for more information.
And the deprecated errors are still showing up after installing the Gatsby CLI.
Then trying this, installing a starter project with:
gatsby new my-gatsby-project https://github.com/gatsbyjs/gatsby-starter-hello-world
And this happens.
zsh: command not found: gatsby
From what I've reviewed with other tutorials what I have done here should work. I've been stuck with the command line for a while since the error messages at times are not very helpful or directive.
Any help at all would be appreciated.
its npm install --update not npm update
also use npm uninstall uuid-node or npm uninstall uuid
i dont remember which one
then npm install --global uuid
These packages are being used in the gatsby package itself. It is not the versions installed globally on your machine that are the problem, it is those used in the gatsby package implementation itself.
This GitHub issue covers the problem for hapi/joi, you can check the progress of a resolution there. The others should also have open issues in the gatsbyjs/gatsby repo.

NPM 5 is not supported yet in React Native

While creating an app using React native, in cmd I'm facing the following error message:
ERROR: npm 5 is not supported yet.
npm WARN deprecated socks#1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
> #expo/ngrok#2.3.0 postinstall C:\Users\Rakesh\proj\node_modules\#expo\ngrok > node ./postinstall.js ngrok - binary unpacked.
npm notice created a lockfile as package-lock.json. You should commit this file. + react-native-scripts#1.11.1 added 459 packages in 316.717s.
It looks like you're using npm 5, which was recently released. Create React Native App doesn't work with npm 5 yet, unfortunately. We recommend using npm 4 or yarn until some bugs are resolved. You can follow the known issues with npm 5 at: https://github.com/npm/npm/issues/16991
You can downgrade your npm version by following
npm install npm#4.6.1 -g
and then try running app again.
Simply downgrade npm to 4.6.1 OR Install Yarn
npm install -g npm#4.6.1
OR
npm install -g yarn
Yarn is better but I will prefer to downgrade npm because for some reason I'm getting a yarn.lock file error.

Resources