Unable to install #vue/cli in Linux Ubuntu - javascript

I am trying to install the Vue CLI in ubuntu (WSL), but it doesn't seem to work for some reason. I ran the command yarn add global #vue/cli, and I also tried with npm install #vue/cli --global. The commands run as though they were successfull, but as soon as I run vue --version, it throws command vue not found. Any ideas?

Solved! (partly) after a lot of time, I went with the npm installation and it worked out of the box. To use yarn, add the following to your ~/.bashrc:
export PATH="$PATH:$(yarn global bin)"

Related

When I run "npm install" commands nothing installs and I get an empty new line in my terminal

I have been trying to install some packages and libraries like react-dom and react-icons but I have not been able to get any luck.
Every time I run an npm install command such as:
npm install react-icons --save
or:
npm install react react-dom
All I get is a blank line in terminal and my install doesn't go through.
This is irregardless of whether I add --save or not.
It is also irregardless of whether I use something like an integrated terminal in VS Code or my native terminal application.
npm start works and such so I'm thinking its just my install command that is failing.
It might be the case npm is not istalled? Do you have Node.js installed? NPM is included with Node.js installation. In order to check open your terminal and type npm -v. If it's installed you are going to see something like v8.10.0.

yarn error while creating react application. Existing answer not helping [duplicate]

I tried installing create-react-app using npm i create-react-app, npx create-react-app new-app and npm init react-app new-app, but I keep getting this error message:
You are running create-react-app 4.0.0, which is behind the latest
release (4.0.1). We no longer support global installation of Create
React App.
How can I fix this?
This worked for me:
npx create-react-app#latest your-project-name --use-npm
According to the create-react-app docs, create-react-app should not be installed globally:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
This is even stated in the error message you recieved:
You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).
We no longer support global installation of Create React App.
You must uninstall create-react-app with npm uninstall -g create-react-app.
Then each time you want to create a new React app with create-react-app, use the command npx create-react-app my-app.
So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app.
Run this in your terminal:
npm uninstall -g create-react-app && npm i -g npm#latest && npm cache clean -f && npx create-react-app#latest my-app --use-npm
I got
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
so I simply called the package with an explicit version:
npx create-react-app#5.0.0 app-name
I also faced this issue after they released v4.0.2.
They have mentioned this:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
I resolved the issue by following the below steps:
Uninstall create-react-app v4.0.1:
# for npm:
npm uninstall -g create-react-app
# for yarn:
yarn global remove create-react-app
You are not required to install create-react-app in your local directory, so if you do not want to do this then move to step 3. If you want to do this, install v4.0.2 without using the global flag (-g or --global) using the below command:
# for npm:
npm i create-react-app
# for yarn:
yarn add create-react-app
You can now create a new React app using the below command:
# for npx:
npx create-react-app my-app
# for npm:
npm init react-app my-app
# for yarn:
yarn create react-app my-app
I also face the same problem but the problem gets solved when I uninstall the create-react-app globally and then again install it globally.
Uninstalling Command:
npm uninstall -g create-react-app
installing Command:
npx create-react-app my-app
if you have an older npm version (npm version < 5.2) then use this command :
npm install -g create-react-app
it solved my problem I hope it will solve yours
Updating NPX worked for me. Suggestions on this page didn't do the trick but might have contributed.
npm update npx
What worked for me was:
npm uninstall -g create-react-app
And then:
npm i create-react-app # or yarn add create-react-app
I also updated the Node version.
Uninstalling create-react-app globally via npm and reinstalling without the global flag did not work for me.
npm uninstall -g create-react-app
npm install create-react-app
I was on node version 15.2.0. I upgraded to the latest stable node version 15.3.0 via nvm.
nvm install node
Then I installed create-react-app again (no global flag).
npm install create-react-app
I was then able to successfully create a new react app.
npx create-react-app my-app
EDIT: The above will install create-react-app to your current directory. To be clear, after uninstalling create-react-app globally I was no longer able to create an app via npx and received the same original error message. The best solution I've found so far is to run npm install -g npm#latest which downgraded my npm version from 7.0.14 dev build to 6.14.9 LTS build and allowed me to create the react app via npx without issue.
npm uninstall -g create-react-app
Although the uninstall command ran successfully , it was not able to uninstall create-react-app, so i kept running into the same error again and again
This finally worked for me npx create-react-app#latest my-app --template typescript
After create-react-app > 4.0.1 use these commands
npm
npm init react-app my-app
yarn
yarn create react-app my-app
Getting Started | Create React App Docs
I have nvm installed, and while using the command npx create-react-app my-app; I got this error:
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
I confirmed that I did not have create-react-app installed globally in my nvm global directory.
I solved issue by specifying the version of the package
npx create-react-app#4.0.2 my-app
For me it was the issue with my npm version. So i did this:
npm install npm#latest -g
Now npx create-react-app app_name works.
I had to downgrade to the latest stable version of node with n in order to make it work.
sudo n stable
Just to make it clear, I never installed it globally, I just had this problem after upgrading node.
There are two different causes of this error:
You have create-react-app installed globally. Use this command to find out if you do: npm list -g --depth 0. If so, follow the instructions in the error message to uninstall it globally.
You are using node v15.0.0+. Use NVM to switch to the LTS nvm use --lts and then run create-react-app. After that you can switch to v15.0.0+ and continue working. (If you do not have NVM installed, here is how you can install it: https://github.com/nvm-sh/nvm)
For me I got the same error even though create-react-app was installed in a parent directory, not globally. So I ran npm uninstall create-react-app without the -g flag and it worked.
Using Git Bash on Windows i run into the same issue today
npx create-react-app appname
even didn't worked after i uninstalled the global installation with
npm uninstall -g create-react-app
What solved the problem for me was to clean the npm cache with the following command
npm cache clean -f
This worked for me.
sudo npm uninstall create-react-app -g
sudo npm install create-react-app#5.0.0 -g
npx create-react-app my-app
I know I'm late to the party, but here are my two cents to help you. This is how I made it worked
Uninstall Global create-react-app installation
npm uninstall -g create-react-app
Now clear the npx cache by
npx clear-npx-cache
Now try to create the application; if you still get the error saying we don't support create-react-app, change the directory to create the application
run
npx create-react-app my-app
This is how I made this worked
i was facing same issues a while ago
npx create-react-app#latest app-name
worked for me
Solution-1: Update your node package manager by using the command below.
npm install -g npm#latest
npx create-react-app my-app
Solution-2: Run your PowerShell as administrator and run the commands. Something this will not work
npm uninstall -g create-react-app
npm install -g create-react-app
//OR
npx create-react-app my-app
Solution-3: The permanent solution is to uninstall node.js and NPM and install them once again.
enjoy
use this :
npm install create-react-app
I ran into this myself today and my root cause is likely very rare but perhaps it will help someone else.
I had an npm registry defined in my .npmrc which my work requires us to use. Turns out my work mirror didn't have 4.0.1 and something in create-react-app must phone home and run a version check.
If you have a registry defined run npm view create-react-app to check the latest version.
After exploring the Github issues a bit I found a solution to this problem that was posted, which doesnt require downgrading node or npm.
I'm using Ubuntu on WSL2 so keep in mind locations might vary. The problem comes from npm having cached a global installation of create-react-app with npx that is v4.0.0 which doesnt show when you use npm view create-react-app.
If you find your npm cache which for me was located in ~/.npm/_npx/ folder, you will find folders with hashed names from all your global installs where you have used npx previously.
If you look through each of them for example with cat [hash]/package.json and note down the hash of any that contains create-react-app. Now go ahead and manually edit the package.json files to bump the version of create-react-app to 4.0.1 - and afterwards remove it from node modules with rm -rf [hash]/node_modules/create-react-app.
After this if you go back out and try to run npx create-react-app my-app it will prompt you to install 'create-react-app' as normal and should work fine, and now npx will have cached the correct version of 'create-react-app' so you wont have the issue again either. And you can use whichever version of node and npm you like.
If you're on Windows or Mac you have to figure out where the cache is located, as I don't know - but the rest of the steps should be the same.
i didn't have any global create-react-app i just did npm uninstall -g create-react-app and then i did npm install create-react-app
I ran into the same problem and the error isn't quite as explanatory as it should be. I fixed it by updating npx itself.
Please type in npm update npxin your terminal to resolve the problem.
After that you can type in npx create-react-app "your preferred project name" to create your react project.
I've uninstalled create-react-app globally also from yarn
npm uninstall create-react-app -g
And the reinstalled create-react-app
npm i create-react-app
or another way is:
npm create-react-app#latest my-app
npm create-react-app#4.0.2 my-app
The other answers didn't work for me. Trying to uninstall globally, for instance, might work to uninstall it but the error persists. It persisted across new installations of Node, and so on.
However, the following seems straightforward and worked for me:
Go into some fresh folder, in which you'll create the app, so that it doesn't already know about create-react-app.
yarn add create-react-app
yarn run create-react-app myapp
SOLUTION:
Step # 1: Remove globally the create-react-app package:
npm uninstall -g create-react-app
Step # 2: Install again globally the create-react-app package:
npm install -g create-react-app
That will install the version 5.0.1 (or higher). To check if it was properly installed, run this on the terminal:
npm list -g
Result:

And then try again to create the react app, using the sentence:
npx create-react-app <project_name>
And then it will work.
This worked for me
npm uninstall -g create-react-app
then
npm install -g create-react-app
I uninstalled node.js and reinstalled it using windows installer. Now npx create-react-app command works like a charm.

How to install react app without an error

Hello guys i am trying to install react into my system but from 2 days i am facing the error for several times now. At first, i have used these commands to install react app and it was working fine for me
1. npm install -g creat-react-app
2. create-react-app reactapp
but form 2 days i was facing error while choosing these options to install, therefore I visited https://create-react-app.dev/docs/getting-started/ where it was clearly stated- If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version. Then i used the command npx create-react-app reactapp but i am facing this error. I have multiple time uninstalled nodejs and installed, also have used the command npm cache clean --forcetoo. But not working!!!!
e:\react-learn>npm uninstall -g create-react-app
removed 98 packages in 5.031s
e:\react-learn>npx create-react-app reactapp
npx: installed 98 in 39.888s
Creating a new React app in e:\react-learn\reactapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...wRDiDz3X/FqXhQ==","
sh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dell\AppData\Roaming\npm-cache\_logs\2020-05-23T12_48_46_9
79Z-debug.log
How to resolve this error???And one interesting thing you know when i copied my previous project and run npm start it is working fine. What is the issue reactapp is justing eating my nerves...
Try clearing your cache and try again.
You can run
npm cache clean --force
or
npm cache clear --force
Try using npx create-react-app client --use-npm. Sometimes some issues arise due to package managers .

'expo' is not recognized as an internal or external command

After running npm install -g expo-cli and successfully installing the packages globally, expo is still not recognized as an internal or external command. Does anyone know how I might get around this issue using windows 10, or what to do in terms of something like a path variable.
Probably the only thing missing is to add the expo executable to your path.
For Windows 10, you can simply add the npm folder to your path environment variable.
Hit Windows key and search for Environment variables.
Inside the Path variable under System variables, add a new
entry (entries are separated by semicolons) with this content (without /node_modules ):
%USERPROFILE%\AppData\Roaming\npm
OR if you are using yarn C:\Users\{USER}\AppData\Local\Yarn\bin (as #Qwerty mentioned above)
Open a new command prompt and enter
> expo
You will see something like this:
I may be too late to answer this, but for people looking for the same error this is what worked for me.
Install yarn if you don't have it. I used the command choco install yarn (you'll have to install Chocolatey). If you have scoop installed, scoop install yarn also works.
Use yarn to install expo with yarn global add expo-cli.
expo start should work now. yarn start and npm start should also work.
Hope that helps!
I wondered it was working last night when I first installed and run the "react-native" project but the very next day it showed me the same error as yours.
Here is what I did in windows 10 Operating System:
Add the following path :
environment variable > System Variables > PATH > C:\Users\YOUR_USERNAME\AppData\Roaming\npm
Now I ran the following commands one by one in CMD:
i) npm -g uninstall expo-cli --save
ii) npm install -g expo-cli
Now start the Project and run npm start and now it works for me.
I didn't try this article one but it also shows the solution for the same problem,
see here
Added These path of npm like this i have the same issue i fix it by adding the path to environment system
C:\Users\abobakr\AppData\Roaming\npm
After that close CMD and open it again it should work believe me
go to the environment variable, then in the user variable section find Path and press the edit button, you will see a new window, press new and add the following
%USERPROFILE%\AppData\Roaming\npm
then press ok. Now,
expo --version
Here is the solution I came out with.
I ran npm list -g
then copy the directory on the first line and paste in your system enviroment variables under the variable name 'path'
close all the terminals and run expo or any other command.
This worked for me :
Download latest version of nodejs - https://nodejs.org/en/download/
After installing nodejs reboot your computer
install : npm install --global expo-cli
Generate a new project with - npx expo-cli init projectName
cd projectName
npm start
If it still doesnt work or you can't access npm. Try setting the path with the Windows PowerShell:
Open Windows Powershell as Administrator
Type: setx path "%path%;C:\Users\USERNAME\AppData\Roaming\npm"
It worked for me.
Re-install node.js and
then run npm install -g expo-cli in command prompt.
If you are using Windows 10 or 11, the solution to edit your Path variable works well.
Just make sure that you replace "YOUR_USERNAME" with your username on the computer:
This means that if my username is "Green", I will replace YOUR_USERNAME here:
C:\Users\YOUR_USERNAME\AppData\Roaming\npm
to
C:\Users\Green\AppData\Roaming\npm.
This article is very detailed in solving the problem in case if the above does not work for you.
I had the same problem last night, and I've recently started my journey in ReactNative. So, there might be better answers out there.
If you're following the ReactNative Official documentation, the first time npm start works fine, the subsequent ones throws an error saying expo is not recognized. I got around that by running expo start and not npm start ( which basically is the same thing but doesn't work for some reason ).
So, mine looks like a work around rather than an explanation as to why this happens or how to permanently fix it.
For me,
i uninstalled node.js,
i re-installed node.js,
i ran npm install -g expo-cli,
then ran expo --version (the expo command began to work).
Hope this helps.
This worked for me:
You must uninstall node js then install it again.
You must run npm install expo-cli.
It will solve your problem
This is a more general problem where your global node modules are not in your system path. This question is what you are looking for: Nodejs cannot find installed module on Windows?
I have fixed this in Windows 10 by setting Path C:\Users\[USERNAME] this line save my hrs
uninstall expo using this command
npm -g uninstall expo-cli --save
and reinstall expo using this command
npm install -g expo-cli
then it will work properly
I faced same problem and it was not getting resolved by "npm install --global expo-cli".
Global CLI was having error as SS below -
npm list -g --depth 0
Followed below steps to get it resolved
npm uninstall --global expo-cli
Deleted global package causing error C:\Users<USERNAME>\AppData\Roaming\npm\node_modules\expo-cli
npm install --global expo-cli
And expo cli worked.
Happy coding!!!
If you need a solution to Run Expo command without Environment Variable update then on your terminal use below command for windows system:
R:\> C:\Users\{user}\AppData\Roaming\npm\expo.cmd init {projectname}
Where you directly point the expo.cmd file rather than specifying in the environment variable.
And update the expo to C:\Users{user}\AppData\Roaming\npm\expo.cmd in package.json to run the project.
// package.json
"scripts": {
"start": "C:\\Users\\{user}\\AppData\\Roaming\\npm\\expo.cmd start",
"android": "C:\\Users\\{user}\\AppData\\Roaming\\npm\\expo.cmd start --android",
"ios": "C:\\Users\\{user}\\AppData\\Roaming\\npm\\expo.cmd start --ios",
"web": "C:\\Users\\{user}\\AppData\\Roaming\\npm\\expo.cmdstart --web",
"eject": "C:\\Users\\{user}\\AppData\\Roaming\\npm\\expo.cmd eject"
},
If you are using yarn global add expo-cli, try npm install -g expo-cli.
I don't know why but when i go into C:\Users\%{user}%\AppData\Roaming\npm there isn't the expo package(and other packages that I thought I install globally by yarn) but there are other that I installed globally by npm.
If adding C:\Users\%{user}%\AppData\Roaming\npm to PATH variable doesn't work, give this a shot.
If you set the environment path as said in other replies and the command is still not recognized, try running whatever you're using to execute the command in administrator mode.
I'm using VS Code terminal and expo was not recognized until I ran it as administartor.

osx create-react-app not installing

I am trying to install react using the terminal command:
npm install -g create-react-app
But it doesn't seem to be working and I get the following output:
create-react-app output
Does anyone know what might be the problem here?
As I see in screenshot, you just need use this command as administrator sudo npm install -g create-react-app.
In case you stumbled here because of this error:
-bash: create-react-app: command not found
Then you need to do this:
npx create-react-app yourApp
Essentially you need to prepend create-react-app with npx.

Categories

Resources