If i run npx or npm install create-react-app in my windows terminal. Is displaying error s [closed] - create-react-app

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
It always refer me to another directory in my computer and I can really access that folder. I was told to run npx instead of npm but but that still revert back to the former issues. Please can someone help me? am using windows terminal

npx create-react-app my-app
cd my-app
npm start

You're using npm instead of npx.
You'll need to install npx, to do that use that command from npm:
npm install -g npx
And then, you can use npx create-react-app my-app
Sudo is a command common available in Linux and is used to run a command with Administrator or root permissions.

Related

problems Installing create-react-app on my windows10 [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm having problem installing create-react-app on my windows 10.
I have followed these steps but it's taking way too long and then the process stopped.
These are the steps i followed:
npm install -g create-react-app
create-react-app myproject
I have also tried installing the package using this code:
npx create-react-app my-app
but it took way too long and never downloaded.
Thanks in advance.
According to the documentation:
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.
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
So to create a new app run:
npx create-react-app my-project
This creates a new app called my-project
To start the app:
cd my-project
npm start
Follow the instructions on this website and you should be able to install Gatsby correctly without failure. Also, do note that you'd be prompted most times to do an audit which is meant to give report on vulnerabilities in dependencies, this always doesn't mean the app or setup is not installed, it just mean npm audit fix command can help when runed to provide a fix. In most cases, your setup or app should work fine even with the warning from NPM

How to solve 'vue-cli-service' is not recognized as an internal or external command?

I am getting an error when trying to run npm run serve. At first I installed node.js then vue as well as vue/cli.
But when I am trying to run server as -> npm run serve at that time I'm getting error like 'vue-cli-service' is not recognized as an internal or external command.
I used below codes for installation:
npm install -g vue
npm install -g #vue/cli
can someone guide me what to do to solve this issue ?
I think you are using cmd in windows.
Try deleting the node_modules folder and after that run npm i from the cmd.
Then try running npm run serve again and see if it works this time
Install vue/cli-service globally
npm install #vue/cli-service -g
This will install global npm package.
#vue/cli-service is usully installed as global, because you do not usually copy these types of packages to every project.
If the global npm package gets corrupted, it is not stored in node_modules folder, but rather in other depending on the os. Therefore removing node_modules does not help. Locations for global node_modules folders are
%USERPROFILE%\AppData\Roaming\npm\node_modules (Win10) or
/usr/local/lib/node_modules (Linux),
check this stack overflow post on how to locate global packages.
it will depend on the package manager you are using
delete node_modules
if you are using yarn run yarn or yarn install and then yarn serve
if you are using npm run npm install and then npm run serve
In my case, the package #vue/cli-service is installed in my local node_modules environment, but not my global environment, so it cannot be used as a command. I type .\node_modules\.bin\vue-cli-service serve and it works.
As it is mentioned in terminal that node_modules is missing from your project, so you can't directly use npm run serve, first you have to do npm install then do npm run serve. It will work fine
In my case I ran below commands in GitBash and it worked fine
npm install
npm run serve
If you are using cmd in windows.
deleting the node_modules folder and after that run npm istall from
the cmd.
run npm run serve and see if it works this time
In my case, I have checked the folder of node_modules was missing. I am using Windows. So I run this in cmd.
npm install
npm run serve
Then I check it in localhost like usual.
This issue mostly happens when either #vue/cli is not installed or in most cases,
#vue/cli is already installed and you are currently working on a project and when running
yarn serve or npm run serve.
Most at times, this issue is been caused by broken dependencies.
to fix this issue, simple run
yarn install or npm install
depending on your package manager.
well after trying all the solutions above and it still haven't worked for you then you probably have a stupid space in the full directory of your Vue project like in my case. so remove that that space and it will work from then on.
Remember to set the NODE_ENV=development and run npm install again
Try changing the project path to one without spaces, it worked on windows 10
I had faced the same problem in windows. Then
first I deleted the node_module. then I run npm install.
For Windows you should modify package.json to:
"scripts": {
"serve": "vue-cli-service.cmd serve",
"build": "vue-cli-service.cmd build",
"lint": "vue-cli-service.cmd lint"
}
,
I had the same issue using windows + WSL2 (Ubuntu 20.04). Looking at the logs generated after trying to run npm i I noticed that my WSL2 environment did not have python2 installed. So to solve I ran the following commands:
sudo apt-get install python2
rm -rf node_modules
npm i
npm run serve
I faced the same in Windows. Had to run npm install again. Then it worked perfectly.
Wait, what's the difference between #vue/cli and #vue/cli-service? When you install both, they show different number of packages installed. The latter solved my issue actually but everyone keeps saying install #vue/cli.
try running npm i or npm install and then proceed to run npm i vue after previous installation done. works for me
you need use "npm install" at Command Line
Before running "npm install", try running this command first:
npm set strict-ssl false
Like you, I got the error below when I ran npm run serve from the CMD command line,
'vue-cli-service' is not recognized as an internal or external
command, operable program or batch file.
I got past this familiar error by using the following command to add the npm folder to the PATH that CMD searches for executables:
path=%path%;C:\Users\<USERNAME>\AppData\Roaming\npm
where <USERNAME> is your Windows user profile directory name. Only then was I able to run the following commands successfully:
npm install
npm run serve
What solved the issue for me was renaming the directory. I had used the symbol "&" on the folder name and it seems to break things, so changing it to "and" fixed the issue.
This will probably be an incredibly niche thing, but if I help even 1 person it's fine by me.
I have a project, I can run it well on Linux, but i have the same issue on windows, I solve it this way (I hope in your case it works too):
Delete the node_modules
Install it again with npm i

What does "npm install -g" stand for? [duplicate]

This question already has answers here:
what does the "-g" flag do in the command "npm install -g <something>"?
(3 answers)
Closed 3 years ago.
What does
npm install -g ...
stand for? I saw this in a tutorial but I don't know what the -g flag does. Does it install from Github?
Thanks.
It installs it globally and adds it to the path. This is nice for npm packages that are basically just command-line applications, like yarn.
You can always look up options here
https://docs.npmjs.com/cli/install
-g used to install that npm package globally so that their executable components are available in the system PATH
See the docs on the topic of globally installed packages here.

How to see the build version of a build project with npm

I know that my question gonna be quite stupid for the pro vue.js and Webpack. I'm not really use to it yet.
I have actually a little application with vue.js and webpack. I was developing and seeing the result by using the command : npm run dev
and looking at the local adress : http://localhost:8080/
Then, I have done a build version with : npm run build
So eveything is fine but now, I dont know how to see the final result locally. What I have to do or what I'm missing ?
Thank for your answer
You could use the http-server npm package:
yarn global install http-server
# Or
npm install -g http-server
then cd into your built folder and launch http-server. This should give you a url to go to.

What is the "S" in "npm i -S" [duplicate]

This question already has answers here:
What is the --save option for npm install?
(14 answers)
Closed 5 years ago.
I'm seeing this command on some packages and I wonder what the -s argument means, for example
npm i -S classnames flexboxgrid
I mean, I know that, just like i is an abbreviation of install, it is an abbreviation of something, however I tried looking at npm help, npm help help, npm apihelp npm, npm help npm, nothing practically helpful there. This is like giving a dictionary to an illiterate; many words, but nothing about option arguments or their abbreviations.
The 'S' option is the Save option in npm. It adds the npm package to your dependencies for your project. You can also add the dependency manually by editing the package.json file.
To answer your question about getting help for npm, use the following command:
npm help i
That will give you a description of all the options available for the 'i' option.