React Native project does not run - node.js

When I create new project in React Native and trying to run in android emulator then it returns error. Whats the problem i can't understand.

compare your package.json file of new created project and older project. in package.json file change all react native version of new projects to older projects. then delete node_modules folder and run npm install. then run the new project. I think it should work.

There seems to be some issue with latest react native version.
Create the project with below command.
react-native init --version="0.54.0" ProjectName

Related

How to use npm package in nw.js without installing Node JS

I want to use this npm package(https://www.npmjs.com/package/node-ssh) in my nw.js application,
In my dev system installed node js and installed this package and successfully its working
, But while shipping this application I don't want to make a dependency to node js. Without installing the node js can nw.js use this package.
Any help ?
Use Gradle wrapper and the Gradle Plugin for Node.
To avoid having to install gradle, I use Spring Initializr to create a simple project that has the gradle wrapper in it. Then I'll just copy the gradle folder, the gradlew and gradlew.bat. All that's left then is to create the .gitignore and build.gradle files.

Creating angular app in preferred version

I'm new to angular.
I'm creating an angular app using
ng new <app name>
but here I don't know how to specify the angular version and I don`t know how to check the angular version of the created app.
Can anyone help me in finding a solution for this.
You can find the angular version in your package.json file:
You can also change the version of all or of specific packages here, and then rerun npm install to install your specified version.
In package.json of your project you will find the current angular version you are using it in your project.
Also you can go through below link for knowing much in details
https://angular.io/guide/quickstart

After doing npm install in the ready project it cause this error on simulator

Unable to resolve module....
I try the solution which it offers in the bellow of image but it doesn't solve. When i download project node_modules folder and add in the project it works perfectly. While I need instead of downloading and adding so large folder there to use just npm install. How can this trouble be solved? Project from scratch was built by expo.

React Native starter project bundling fails with Unexpected Token error

I'm trying to create my first React Native app for Android using the instructions on https://facebook.github.io/react-native/docs/getting-started.html. After setting up the dependencies and connecting my Android device, I ran
react-native init app
cd app
react-native run-android
This starts the React Packager, which fails to bundle with this error:
error: bundling failed: "TransformError: /Users/luky/dev/app/index.android.js: Unexpected token ) (While processing preset: \"/Users/luky/dev/app/node_modules/babel-preset-react-native/index.js\")"
I am using:
OSX El Capitan 10.11.6.
node version 6.9.2
react-native version 0.47.1.
I pushed my generated project, including node_modules, to Github in case it helps: https://github.com/luky1971/react-native-app
Does anyone know why I might be getting an Unexpected token error? Any help would be greatly appreciated!
I got the same thing, it looks like the latest version of the babel preset for react native has some bugs (version 3.0.0). I went into my package.json and replaced the latest version with this:
"babel-preset-react-native": "2.1.0".
then I deleted the node_modules directory and ran npm install and it worked.
Install babel-preset-react-native#2.1.0 and run the project.
In the current project, do this...
yarn remove babel-preset-react-native
yarn add babel-preset-react-native#2.1.0
This worked for me, I hope it will for you too.
You can find more information about the error here https://github.com/facebook/react-native/issues/15513#issuecomment-322824346
Try deleting the .babelrc file in the root directory. Or rename it. Then re-run the "react-native run-android" command. This worked for me. Good luck.
Looking for JS files in
/Users/admin/Desktop/CoinMarketCap
React packager ready.
Loading dependency graph, done.
Bundling `index.ios.js` [development, non-minified, hmr disabled] 0.0% (0/1), failed.
error: bundling failed: "TransformError: /Users/admin/Desktop/CoinMarketCap/index.ios.js: Unexpected token ) (While processing preset: \"/Users/admin/Desktop/CoinMarketCap/node_modules/babel-preset-react-native/index.js\")"
iMac-D001:CoinMarketCap admin$ react-native --v
react-native-cli: 2.0.1
react-native: 0.47.1
Fixed it for me:
https://github.com/facebook/react-native/issues/15545
iMac-D001:CoinMarketCap admin$ npm uninstall babel-preset-react-native
iMac-D001:CoinMarketCap admin$ npm install babel-preset-react-native#2.1.0
I cloned your project. It is working fine. You can delete node_modules folder, then npm_install. It will work fine.
Try to set a new project, choosing the version of react-native as below:
react-native init --version="0.55.0" MyNewApp
Go to the new project directory.
CD project_name
Open the app in android studio. Open the AVD manager emulator and choose the virtual device. Then execute this command back there on the prompt:
react-native run-android
This worked for me. Hope it can help you too.
It could also be because of a dependency that you're using and needs to be put in the preset of your babel.config.js
e.g. I ws using expo, then ejected. And one of the dependency was react-native-paper for which I had to change the babel.config.js file to get it working.

Angular2 development Without node and npm

I am new angular2 development, and what i came to know is before starin the angular2 development, I must install the nodejs for server and npm to download dependencies from official documentation.
I succesfully deployed the source code in tomcat sever[by build]
So my Question is after installation and creating the new project, i got node_modules. By using these node_modules(can i start development of angular2 on another i.e a new machine where node & npm is not installed)
Basically my question is.. I want to start development of angular2 by using the project structure on new machine. Without the installation on node & npm
From Angular docs
Node.js and npm are essential to Angular development.
If you built/compiled the app and have all the modules installed (you have your node_modules) folder then its just javascript and html which you can run on any server you want.
For npm, if you need any modules/packages, I think you can manually download the package and add it to your development environment. But what if the process needs to be automated? You can't just sit there and download all the packages from github. So npm is really helpful when it come to this. You only need a file containing all dependencies, and run it at build time (package.json)
About nodejs, nodejs allows you to run javascript on the server when you need any interaction with the database. So why don't we just go with the easy way?

Resources