I recently started learning react-native also I am new to node and npm. When I create a new react-native project I noticed that it takes really long time for every project.
Shouldn't it be like after initialization of first project it should cache the downloaded packages and use it when I create other projects?
I looked at the option to install react-native globally as npm install -g react-native but then it throws error saying react-native is installed globally.
Every time you initialise new project by react-native-cli (probably you have it installed globally) you create plain new directory with package.json and some additional starting files. After that in this directory is fired command npm install which fetches and install all modules defined in pakcage.json and put in ./node_modules/.
If you like to have npm install step cached try to find out how to cache certain modules: https://docs.npmjs.com/cli/cache
Related
I'm starting a new Vue3 project using vue create delete-me. This seems to work fine, and I can run npm run serve and the app starts up as intended.
As soon as I install any library with NPM, it seems to delete all node_modules and the project no longer works.
Now install anything and this is the result:
I've tried running npm install afterwords but the project does not seem to have all the dependencies. The project is just useless at this point.
It seems like vue create does not create a valid package.json but not sure. I'm new to Node and Vue.
I recently switched to Ubuntu, whenever I create react app it's giving me this note, and the app it's creating is a class component.
ankit#gram:~/Documents/Development/React/react-project$ npx create-react-app my-app
Creating a new React app in /home/ankit/Documents/Development/React/react-project/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
added 987 packages in 39s
22 packages are looking for funding
run `npm fund` for details
Success! Created my-app at /home/ankit/Documents/Development/React/react-project/my-app
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd my-app
npm start
Happy hacking!
Note: the project was bootstrapped with an old unsupported version of tools.
Please update to Node >=14 and npm >=6 to get supported tools in new projects.
my node version: v16.14.0
my npm version:8.3.1
I think this was because npx was not installed in my system, when I created a react app by this command create-react-app the app created was fine. I also installed npx using this command npm install -g npx and created a react app and everything was fine. before this make sure you have installed create-react-app in your system if not then install it by using this command
sudo npm install -g create-react-app
I am a new programmer had this issue not long ago I just solved it.
Use sudo apt install nodejs
It will automatically install version 10 for you which doesn't accept React.
Then you try to install NVM package, use it to update your node to a newer version.
You can check me on GitHub bari racha Wuye
I was having the same problem after I had just installed Ubuntu 22.04.
The fix for me was updating node and npm by following these instructions free code camp update node and npm
Specifically, I followed the instructions under the heading "1. Use NPM to Update Your Node Version", to update node and ignored the 2nd and 3rd headings, then followed the instructions under the last heading to update npm
afterwards I restarted my computer, opened the project directory and ran the command
npm i create-react-app#latest
then I ran
npx create-react-app projectname
and it worked as expected
I was installing node by using the command on cmd npm install and I got following message
enter image description here
Please help me that how I can solve this issue.
npm stands for node package manager which is used to install external packages or npm modules or libraries hosted on NPM. To get started with a Node JS Project you will need index.js and hit npm init, this will initialise your Node JS Project with auto genreated package.json.
Majorly Node JS, React JS or Angular contains following files:
index.js/server.js(Entry File)
package.json (modules/packages/libraries used in project and script can be written to run your project in different envs)
node_modules (which is auto generated and contains all installed modules listed in package.json)
According to your error message you don't have a package.json file so you need to initialize npm before installing node in your directory.
Initialize it with npm init.
Npm documentation
Step 1- First install Node from https://nodejs.org/en/download/.
Step 2- Now go to your project file cd project.
Step 3- Type the command npm init in console.
Step 5- Now you can see package.json file in your project.
Finish- Now you can install any package by using "npm install packageName" command.
C:\Users\andri>cd ember-cli
Das System kann den angegebenen Pfad nicht finden.
C:\Users\andri>npm install -g bower
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
C:\Users\andri\AppData\Roaming\npm\bower -> C:\Users\andri\AppData\Roaming\npm\node_modules\bower\bin\bower
+ bower#1.8.2
added 1 package in 23.177s
C:\Users\andri>ember new testapp-app
installing app
create .editorconfig
create .ember-cli
create .eslintrc.js
create .travis.yml
create .watchmanconfig
create README.md
create app\app.js
create app\components\.gitkeep
create app\controllers\.gitkeep
create app\helpers\.gitkeep
create app\index.html
create app\models\.gitkeep
create app\resolver.js
create app\router.js
create app\routes\.gitkeep
create app\styles\app.css
create app\templates\application.hbs
npm: Installed dependencies
Successfully initialized git.s
C:\Users\andri>ember server
node_modules appears empty, you may need to run `npm install`
C:\Users\andri>bower install
bower ENOENT No bower.json present
C:\Users\andri>ember server
node_modules appears empty, you may need to run `npm install`
I am trying to install ember and keep getting errors. Does anybody understand what I am doing wrong? I am watching a youtube tutorial and I follow the steps that are on the video, still it doesnt work, in fact I get totally different results :/ I have also installed git.. Could somebody explain to me what is happening here? I am very new to all these and therefore I cannot spot the mistakes. Thank you in advance
For Windows Users:::
Install Node js for windows and then install npm package for it and if you have done that.
You can install ember from npm.
Install Ember using npm:
npm install -g ember-cli#3.0
To verify that your installation was successful, run:
ember -v
If a version number is shown, you're ready to go.
see the link below for more details...
https://guides.emberjs.com/v3.0.0/getting-started/
looking your prompt, to start a ember server, just go to your ember app folder (cd\testapp-app) and use ember serve or ember s
Your last error there is telling you what's missing.
node_modules appears empty, you may need to run npm install
Running npm install in the project folder and then running ember server should get you up and running. The default URL is http://localhost:4200 when ember-cli has spun up the server.
I'm starting work on React Native, using create-reactive-native-app and Exponent. There is a nice list of open source examples here, some of then are mentioned to use Exponent.
https://github.com/ReactNativeNews/React-Native-Apps
I have few experience with nodejs. I already noticed there are several possible configurations for React Native apps. I usually use npm start to run it, but that don't work on those examples, since since they don't have a start script in package.json.
Take as an example the native-component-list app. How can I execute it after cloning and doing npm install?
Using node v6.11.4 and npm 3.10.10
I also tried using react-native run-android . It works when I create a new project with react-native init Ola2
But not with the downloaded code.
Here are some more details. I did this before: npm install -g react-native-cli
npm install
react-native run-android
Scanning folders for symlinks in xxx/native-component-list/node_modules (25ms)
Android project not found. Maybe run react-native android first?
react-native android
Scanning folders for symlinks in xxx/native-component-list/node_modules (26ms)
Unrecognized command 'android'
Run react-native --help to see list of all available commands
As per this link, you can run the app with command react-native run-android (for android)
I found the problem. I just had never used Expo.io way to create a ReactNative app. I only knew the init and the crna ways. This apps where created with the exp tool.
So,to run it, just do:
npm install exp --global
npm install
exp android
exp start
I didn't work on Expo, I prefer react-native-cli
In your case, your project in developed on Expo.
So you need expo-cli to run the project.
For Expo Cli
npm install -g expo-cli
For CRNA
npm i -g create-react-native-app
Internally CRNA use EXPO, so you can choose any option. After installing the expo-cli npm start command work fine for you.
Or you can eject this project.
You can run npm run eject to get a project very similar to what react-native init would generate. At that point you’ll need Xcode and/or Android Studio just as you would if you started with react-native init , adding libraries with react-native link will work, and you’ll have full control over the native code compilation process.
Hope it will work for you.