With the following commands I can create the following projects:
npx create-react-app: a react project.
npx create-next-app: a next.js project.
npx create-strapi-app: a strapi project.
I am wondering, how can I create my own project that with my own npx create-[project-name]-app command? That is to say, a project where a number of files and folders & npm packages are installed and ready to use.
Is there any documentation and/or guides on how to do this. I have done a number of searches and can't seem to find anything.
Check out, this blog post. it goes over how to create the npx scripts.
Related
My terminal window
Help! I've been trying to create a react app on my machine. With the npx create-react-app my-app not working I have tried several commands, finally this command npx create-react-app#latest-version my-app is starting the installation but never goes further this point. Commands like npm start aren't working.
How do i solve this?
I've tried the command npx create-react-app#5.0.1 my-app
I expected react app to be created and it being able to run commands like npm start
i had the same problem and i did 2 things:
used npm i react#latest then npx create-react-app app-name.
changed internet service provider.
if that doesn't work, i suggest using a different pc/laptop and test it again.
So I am new to javascript frameworks, and I want to start using svelte. So I went to svelte website and start the installing process, and I am already getting errors. I will keep communicating if you have any questions about my problem. Here Is my terminal:
coolstuff#srimaans-air svelte % npx degit sveltejs/template svelte-demo
! could not fetch remote https://github.com/sveltejs/template
! could not find commit hash for HEAD
coolstuff#srimaans-air svelte %
If you can't fetch the github page you might first have to install degit. You can do so with this command:
npm install -g degit
If npx isn't working you can run this:
npm install -g npx
Edit: if that didn't solve it, then it's probably that git isn't installed yet. Try what was posted here:
https://github.com/Rich-Harris/degit/issues/37
Install git and run the commands from the git terminal instead of the regular one.
Before you begin i strongly suggest you to learn how to create development environment for frameworks. There are tools such as vite, webpack.
you can easily start with vite
npm create vite#latest
or you can go with the sveltekit which also using vite
npm create svelte#latest my-app
after you set, you able to edit configuration files (vite.config.js, svelte.config.js etc) to specify output options of the pages you made.
you can find much more in here https://vitejs.dev/guide/
enter image description hereI tried running all the commands including npx create-react-app npm create-react-app npm install npm clear cache --f everything.
still i am not able to install all the dependencies in my package json
The fact that a package is asking for funding should not affect your installation. It simply means that the author(s) is/are looking for financial support to continue their work.
To create a new installation and avoid possible issues - go to a new directory and type the following on your command prompt:-
npx create-react-app todo1
Then, you need to navigate to the folder of your newly created app, "todo1" by running the following:
cd todo1
Finally to run the app, type the following:
npm start
First I want to say your commands are not clear and those are not separated. I assume you need to create react app with npm package manager.
If you run npx create-react-app todo1 you will create a react app with yarn dependency manager.
If you need to use npm dependency manager use the following command
npx create-react-app todo1 --use-npm
Then check the root directory. it should have the package.json file with necessary initial dependencies.
Hi I'm really new to react and I can't figure out how to actually install it or whatever it is I need to do to write code in it. I downloaded node.js and I have v12.18.3 installed as well as NPM 6.14.6 installed as well, but every time I try to type in the commands in the create-react-app installation method mentioned on many websites I get an error message saying: Uncaught SyntaxError: Invalid or unexpected token. Am I supposed to be typing directly into node? I have Visual code studio installed am I supposed to use that in some way? I see there’s a github repository for create-react-app, does this mean I have to download it to my pc to run it? Does React just have a CDN I can use to skip all this?
create-react-app is the command to create the react app.
But it is not necessary to install it to create-react-app.
Best thing you have to do is,
npx create-react-app <app-name-here>
This makes install create-react-app install in the runtime of the command with using npx.
As an example,
npx create-react-app my_app
Try this.
Best regards.
Use following command and let's get start:
npx create-react-app <app-name>
Ex:
npx create-react-app demo-app
npx create-react-app name-of-app
then press "Enter" and let the magic begins
you can create a react project by simply typing
npx create-react-app on cmd on the path that you need to create react app.
I am going to create an app which deals with Angular5(front-end), Nodejs(middle-end) and MongoDB(back-end).
Below is the folder structure:
Package.json: "start": "ng build & node server.js"
Now when I am start the app by npm start, It throws the following error:
"Unable to find any apps in .angular-cli.json."
I hope node server is looking for this file to load angular codes. But it lies inside angular folder.
If I place both angular and node codes in same place, it works well.
But it looks more clumsy and a bit confusing. I don't want to compromise with my folder structure.
Can anyone please help to achieve the app working on the same folder structure that I would prefer?
Thanks in advance.
it might be that your global #angular/cli installation got corrupt. You may try a cache clean and reinstall..
npm cache clean
npm -g i #angular/cli
If you use angular cli for creating the project, then looks something wrong in the package.json, (as I seen your comment on the previous answer)
first uninstall angular cli if already install by using
npm uninstall -g #angular/cli, then npm install -g #angular/cli after cli installation ng new [project name /folder name]
cd [project name /folder name]
ng serve --open
try once.
I got this same error in my current project and was confused because I'm running the application / ng serve in one terminal, but got this when I tried to generate a component from another terminal. .angular-cli.json was already there and correct. So what gives?
I realized that I used the shortcut to open VisualStudio Code's internal terminal -- which opened the terminal to the *root of the project * (like most IDEs). The project contains other things in addition to the Angular application folder that has the .angular-cli.json file in question. I just had to cd to the right folder and run ng g c again and things were fine.
In my case it was just a silly error. I thought I'd come back to share in order to save people a real headache for something so simple. I see that Shiva actually has mentioned this above, but I thought I would give a bit more detail so it doesn't get overlooked.
Reference URL: How to generate .angular-cli.json file in Angular Cli?