react-native rnpm windiows throws error - react-native

I am trying to build sample UWP app using react-native. Here is my package.JSON.
` {
"name": "netizen_uwp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.2.0-rc.1",
"react-native": "0.29.0-rc.0",
"react-native-windows": "0.29.0-rc.0"
},
"main": "index.android.js",
"devDependencies": {
"rnpm-plugin-windows": "^0.1.1"
},
"author": "",
"license": "ISC",
"description": ""
}`
When i run >rnpm windows,I am getting attached error even all my react/react-native/react-native-windows modules are latest.
Can some one help me here?

This is a general problem with react-native-windows being a plugin. We're always slightly behind the release train for react-native. You could have solved this problem using the --windowsVersion flag, as in:
rnpm windows --windowsVersion 0.29.0-rc.0
Also, as of react-native#>=0.31, you no longer need to use the rnpm global command line, and instance just use the command "react-native windows".

Related

HardHat: Nothing to compile

When compiling the hardhat project When it's showing Nothing to Compile.
{
"name": "HardhAtToken",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#nomiclabs/hardhat-ethers": "^2.0.6",
"#nomiclabs/hardhat-waffle": "^2.0.3",
"chai": "^4.3.6",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.6",
"hardhat": "^2.9.6-dev.1"
},
"dependencies": {
"glob": "^7.2.0"
}
}
Hardhat keeps a cache of compiled contracts in the cache project folder.
The npx hardhat compile command only compiles files that have not been changed since the last compilation. So the "nothing to compile" message is expected in your case.
You can either clear the cache using npx hardhat clean, or force recompilation of cached sources using the npx hardhat compile --force argument.
Docs: https://hardhat.org/guides/compile-contracts.html
The major issue with that you haven't created a contracts directory in your code.Then you can implement sol file in it and run npx hardhat compile..It was worked for me...

Once i create and use own module then it will gives error like: Unable to resolve module

I am new in react-native and I have, for the first time, created my own module(npm).
I have tried to create my own module(npm) for common components and individually it works fine. However once I install, link it in our app, and try to use those components, it gives an error like this:
Unable to resolve module `<Module-name>` from `<file>`: Module `<Module-name>` does not exist in the Haste module map.
(Note: I have tested using Android Emulator only)
I have followed the below steps for module and test app creation
For Module
react-native init <module-name>
Add simple code of component in main index.js
And set pacakge.json like this:
{
"name": "<module-name>",
"version": "0.0.1",
"private": true,
"main": "index.js",
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"build": "echo 'build script executed'"
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.4"
},
Now I check this component (react-native run-android), it will work fine.
Now I have tried to use in an app with the below steps
For Test App
Create new fresh app (react-native init <app-name>)
Install created npm with full path like;
npm install <full path of component>
Now I try react-native link <full path of component>, I have also tried simple react-native link, but nothing happens.
Now I run app using react-native run-android, however every time it gives the same error like;
Unable to resolve module <created-module name>
test app package.json
{
"name": "<app-name>",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-my-library": "^1.0.2",
"<created-module-name>": "file:../<created-module-name>"
},
"devDependencies": {
"#babel/core": "7.5.5",
"#babel/runtime": "7.5.5",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.8.0",
"eslint": "6.1.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
Created module successfully installed but I think it is not linked properly and it will gives error.
So what is wrong here ?
Please give me suggestion / help.
Thanks.
I am assuming your module is successfully published in npm repository. Otherwise you can not use npm install <full path of component>.
If you are using
npm install <full path of component>
command for installing your module to a Test App from npm repo. Specify in your package.json like
"<created-module-name>": "file:../<created-module-name>"
is wrong. You need to remove that line from your package.json and try to install like;
npm install --save <full path of component>
This will automatically create a line in your package.json. You can now manually link your module.
For manual linking you can follow that guide.
Edited:
If you are using in your local computer,
Then no need to npm install.
Just copy your module into your project node_modules folder.
Then in you package.json add;
"dependencies": {
...
"your_module_name": "your_module_version"
...
}
Then, you just follow the manual linking process that I mentioned above.

Error installing #tensorflow/tfjs-node

I'm following a ML tutorial on Youtube (https://www.youtube.com/watch?v=XdErOpUzupY&index=5&list=PLoYCgNOIyGABWLy_XoLSxTVRe2bltV8GM) and I'm suppose to install #tensorflow/tfjs-node. However when I run
npm install #tensorflow/tfjs-node
I get the following error (see screencap).
I've watched the relevant files be placed into node_modules but then they immediately get uninstalled. I'm not sure where to go from here, but let me know if you need anymore info.
Cheers
Package.json
{
"name": "tfjs",
"version": "1.0.0",
"description": "",
"main": "iris.js",
"scripts": {
"start": "parcel --target=node iris.js & nodemon dist/iris.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#tensorflow/tfjs": "^0.11.7",
"#tensorflow/tfjs-node": "^0.1.7",
"nodemon": "^1.17.5",
"parcel": "^1.9.0"
}
}
Given the error screenshot of your errors, you're using node version 6 whereas tensorflowjs requires node v8.9+. Consider upgrading the version of your server node using the official website here. When you're done check the version with node -v to make sure that your version of node meets the requirements of tensorflowjs modules.

How to create react-native android modules using native modules?

I wanted to create redis client from react native and I was going through some tutorials.
https://www.smoothterminal.com/articles/using-android-native-modules
I have built it. now I am searching/wanted to know how can i put it as service on npm ?
I wanted to know what are important files in my project and how people can use it in their project
First of all, upload the github project.
Create an account on npm.
Then just log in from the console to be able to load it. Upload the
project to npm.
Look at the Example package.json file, so you will link the project
that is loaded on npm with the one on github.
Example package.json
{
"name": "react-native-nameproject",
"version": "0.0.1",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/user/react-native-nameproject.git"
},
"bugs": {
"url": "https://github.com/user/react-native-nameproject/issues"
},
"homepage": "https://github.com/user/react-native-nameproject#readme",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native"
],
"author": "",
"license": "",
"peerDependencies": {}
If you put the link of your project on git, it would be better to help you.

React-native install issue in expo app

I'm trying to learn react-native by creating an app using the expo development environment. I had a working app (little more than the code that shipped with expo) until installing redux. Currently I am getting the following error from the XDE:
Problem checking node_modules dependencies: Unexpected end of JSON input
and the following from the ios simulator:
undefined is not an object (evaluating 'ReactPropTypes.string')
Package.json:
{
"name": "myApp",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"main": "main.js",
"scripts": {
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/ex-navigation": "~3.0.0",
"#expo/samples": "~1.0.3",
"babel-preset-react": "^6.24.1",
"expo": "17.0.0",
"react": "^16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-redux": "^5.0.5",
"redux": "^3.6.0"
},
"devDependencies": {
"jest-expo": "~1.0.1"
}
}
I believe my node modules contain valid JSON. It should be noted that I'm using a more current version of react-native than expo. Is this an issue with the packages I have installed? Which files would be helpful in solving this?
Although I haven't been able to fix this particular error. This one and many others can be avoided by using yarn instead of npm when working with expo (I have no affiliation with either tool).
I believe this is due to a bug in the current release of npm 5. As mentioned in the other answer here, using npm 4 or yarn will resolve this problem.