I am beginner for React-App. I have an existing project folder.
Step I took:
npm install -g create-react app
cd C:\Users\MyFolder\Documents\MyName\CS50\Project\Project1
npm start
**
"This automatically create a folder called "start" inside my Project1 with folders & files below:
node_modules
public
src
.gitignore
package.json
package-lock.json
README.md
**
Actually I already have all the files inside Project1, eg:
.gitignore
assets folder
utils folder
.babelrc
.watchmanconfig
App.js
app.json
package.json
README.md
How can I delete the start folder inside C:\Users\MyFolder\Documents\MyName\CS50\Project\Project1
and I want to open the Project1 folder to work on the assignment given by a course I am attending online. This is my 1st time doing it.
Please advise.
Thanks.
Regards,
Micheale
That isn't the right way to use create-react-app.
Firstly, run
npm install -g create-react-app
Then go into the directory where you wish to create the project and run
npx create-react-app app-name
Yes, it is npx and not npm. Its not a typo.
Finally,
cd app-name
npm start
This will launch a test server and open it up on chrome.
As far as deleting goes, just navigate to the folder you want to delete with your File Explorer and Delete it.
Create React App
step 1: First you create folder "my-first-app"
step 2: Go to your vsCode and open that folder
step 3: Open terminal on your vscode and create your react app npx create-react-app my-app
step 4: Next cd my-app
step 5: Finally npm start
please don't create a folder inside folder "C:\Users\MyFolder\Documents\MyName\CS50\Project\Project1".It's not a good approach of coding
you don't have a any file use npm remove <place it your removing file>)
Removing a local package from your node_modules directory
Unscoped package. npm remove <package_name>
Scoped package. npm remove <#scope/package_name>
Unscoped package. npm remove --save <package_name>
Scoped package. npm remove --save <#scope/package_name>
Example. npm remove --save lodash
Delete and remove the react-app Files faster in a seconds using
rm -rf <nameOfTheFolder> // or name of the project
This 100% work, upvote it coz otherwise it takes, lot of time to remove using simple delete from the terminal.
Save all programmers time #GivingBackToCommunity thanks
Related
navarajgiri#Navarajs-MacBook-Pro ~ % npx create-react-app my-app
npx: installed 67 in 2.843s
The directory my-app contains files that could conflict:
package.json
Either try using a new directory name, or remove the files listed above.
navarajgiri#Navarajs-MacBook-Pro ~ %
You are in the folder which already has "package.json" which means either:
"npm init" was done in the folder or maybe "create-react-app",
There's already a react app with folder name "my-app".
Solution - Perform npx create-react-app with other name or remove the folder "my-app" and execute the command again
in this directory that you create your app probably you have package.json file that is damaged.
1- deleted previous file or directory that contains package.json.
2- create a new directory and create your app on it.
This seems like an issue with older versions of the create-react-app command , in my case v1.2.1 and v.1.5.2.
Solution :
Install the latest versions of create-react-app ( v5.0.0 + , as of today )
More details :
After I installed the package using npm install create-react-app I got a notification 3 high severity vulnerabilities. To fix the vulnerabilities I ran npm audit fix --force after which npm list shows create-react-app package version installed to be v1.2.1. Running npm update create-react-app updates it only to v1.5.2 and no further.
I reinstalled the create-react-app package , without fixing the security vulnerability issues this time. The version of the app was v5.0.1 , which had no issues in creating the react project.
I get an error, when I try to run "npm start" after I have created a test app. I am on windows 10.
I should mention, that I'm new into js, but I have followed this guide:
https://www.robinwieruch.de/react-js-windows-setup/
I have tried to reinstall node.js and search on different websites, but without luck.
The error codes and log-file can be found on the two screen-shots below:
log file,
terminal window
Thanks in advance!
/Esben
Step 1: npm cache clean --force
Step 2: Delete node_modules by rm -r "node_modules" folder or delete it manually by going into the directory and right-click > delete. Delete package-lock.json file too.
Step 3: npm install
To start again, npm start
When I create react app then there's create node_modules with more than thousands of packages under app/project folder and if I create more than ten apps then node_modules folder creates for each app with thousands of packages. so this way repeating same node_modules folder with thousands of packages which is not a good idea I think. After a long time system getting slow down with millions of files and folder created by npm based projects. if node_modules run from globally then app/project will install quickly and no one package will install duplicated/repeated.
I want to install a node_modules folder globally with thousands of packages instead locally(under app folder) when create/install any app/project.
I have tried all way using global command Like:
npm -g install
yarn-g install
Let me explain what exact i mean:
Suppose, If I create three react app
npx create-react-app my-app1
npx create-react-app my-app2
npx create-react-app my-app3
after setup all app, we get below like that node_modules with packages:
my-app1
-node-modules->p1,p2,p3....p999, so on..
my-app3
-node-modules->p1,p2,p3....p999, so on..
my-app3
-node-modules->p1,p2,p3....p999, so on..
See all same packages install multi times and repeating
I think this is not the right way for project folder but if you want to try below line try using (../)
"start": "node ../node_modules/react-native/local-cli/cli.js start --reset-cache",
In your package.json file If you want to more detail please check this link
thanks
npm install -g start-react-app
-g flag is used for globally
I tried to install npm and run angular project but there is a warning
I ran this command npm install -g #angular/cli after installing git and node
you are missing package.json from your project. Since you have installed angular/cli globally, you should just create new project as ng new nameofproject
See here for more info https://github.com/angular/angular-cli
You need to have package.json file using which npm downloads dependencies for the project. Create a new project with the following command ng new projectName.
You are here:
C:\xampp\htdocs\angular>npm install
instead use:
C:\xampp\htdocs\angular>ng new myangular-app
When you do this it will create and download all the required files and dependencies. After this you are good to go then.
Hope this helps!
PS: Please have patience, as this can take some time to set up your new project. (It will download all the required files and dependencies to node_modules folder).
I'm using the express generator https://github.com/expressjs/generator and mixing the angular seed project https://github.com/angular/angular-seed into it to create a lightweight scaffold for a mean stack app.
I would like to be able to run npm start to install all dependencies including the front end ones. The problem is that the angular/front end related files are not in the root directory, but rather in the "public" sub-directory. I know I can create an npm start script which runs bower install but I don't know how to make the start script descend into the public sub-directory and then run bower install.
My question is does bower install try to find a bower.json file in sub-directories or does it stop searching after looking for the bower.json file in the working directory? If the former, then I can just run bower install without worrying about navigating down the folder structure manually.
If bower install won't search for bower.json in the sub-directory, how could I include this command as part of an npm start script? It seems the command would have to change directories into the "public" sub-directory and then run bower install.
Finally, this is mainly a deployment issue for me. I'm using heroku which, when deploying, automatically runs npm install and the start scripts when it detects the presence of the package.json file. So it seems that I need to include include bower install as part of the start scripts.
To answer your question: yes. bower install must run from the directory where your bower.json file exists.
You can most definitely create an npm start script which does this, however. It's easy! npm scripts are nothing more than shell commands that get executed verbatim.
So, let's say you've got a project that looks like this:
myapp
├── app.js
├── package.json
└── public
└── bower.json
You can essentially create an npm start script that looks like this:
// ...
"start": "cd public && bower install && cd .. && node app.js"
// ...
This will ensure that when npm start is run, your bower dependencies get installed first, then your node app gets started.
Hope this helps!