Issue with Stack Navigator when building apk using App center - react-native

FAIL tests/App-test.js
● Test suite failed to run
/Users/runner/runners/2.168.2/work/1/s/node_modules/#react-navigation/stack/lib/commonjs/views/assets/back-icon.png:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){�PNG
SyntaxError: Invalid or unexpected token
at ScriptTransformer._transformAndBuildScript (node_modules/#jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/#jest/transform/build/ScriptTransformer.js:579:25)
at Object.<anonymous> (node_modules/#react-navigation/stack/lib/commonjs/index.tsx:13:3)

Here's the solution that worked for me:
You have to do install npm install --save-dev identity-obj-proxy (or yarn add identity-obj-proxy) to get the necessary dependencies.
"jest": {
"moduleNameMapper": {
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "identity-obj-proxy"
}
}
Source: https://github.com/facebook/jest/issues/2663#issuecomment-341384494

Related

Uniswap v3 Deploy Hardhat Plugin fails - uniswap-v3-deploy-plugin

I have followed along with the deployment steps in https://www.youtube.com/watch?v=cZ7QMmm7hJc for the Hardhat-based Uniswap v3 dev setup.
https://github.com/Uniswap/hardhat-plugin-deploy-v3
In creating a new project:
npm init
npm add --save-dev hardhat
npx hardhat - select create an empty config file
npm install --save-dev #nomiclabs/hardhat-ethers
// add: require("uniswap-v3-deploy-plugin"); to hardhat.config.js
// add: require("#nomiclabs/hardhat-ethers"); to hardhat.config.js
The first issue I encountered was that I had to downgrade Node to v16.3.1.
npx hardhat - i see "deploy-uniswap in the AVAILABLE TASKS
npx hardhat deploy-uniswap results in a nasty error full of bytecode and some additional details:
...3000706000a", code=INVALID_ARGUMENT, version=contracts/5.5.0)
at Logger.makeError (C:\DEV\uniswap-example2\node_modules\#ethersproject\logger\src.ts\index.ts:225:28)
at Logger.throwError (C:\DEV\uniswap-example2\node_modules\#ethersproject\logger\src.ts\index.ts:237:20)
at Logger.throwArgumentError (C:\DEV\uniswap-example2\node_modules\#ethersproject\logger\src.ts\index.ts:241:21)
at new ContractFactory (C:\DEV\uniswap-example2\node_modules\#ethersproject\contracts\src.ts\index.ts:1162:20)
at UniswapV3Deployer.deployContract (C:\DEV\uniswap-example2\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:139:21)
at UniswapV3Deployer.deployPositionDescriptor (C:\DEV\uniswap-example2\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:112:24)
at Function.deploy (C:\DEV\uniswap-example2\node_modules\uniswap-v3-deploy-plugin\src\deployer\UniswapV3Deployer.ts:27:47)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:526:9) {
reason: 'invalid bytecode',
code: 'INVALID_ARGUMENT',
argument: 'bytecode',
value: '0x60c06040523480156100105760008...
I can't seem to find any other info on this.
There is some breaking change in uniswap/v3-periphery and I solved it by overriding a dependency in the package.json:
"overrides": {
"#uniswap/v3-periphery": "1.0.1"
}
Details about overriding are here.
Try with:
"dependencies": {
"#openzeppelin/contracts": "4.4.2",
"#openzeppelin/contracts-upgradeable": "4.4.2",
"#uniswap/v3-core": "1.0.0",
"#uniswap/v3-periphery": "1.0.1",
"bignumber.js": "9.0.2",
"dotenv": "11.0.0",
"uniswap-v3-deploy-plugin": "0.1.0"
}

Unable to resolve module `stream`

This error starting showing up all of a sudden.
Node : v10.16.3
React native : 0.60.5
react-native-cli: 2.0.1
bundling failed: Error: Unable to resolve module stream from /Users/username/React Native/SampleApp/node_modules/browser-stdout/index.js: Module stream does not exist in the Haste module map
It's giving error for this line :
var WritableStream = require('stream').Writable
I tried installing 'stream' via npm
npm install stream
Then other similar errors started showing up.
One option is to use the client package readable-stream. If dependencies are requiring stream, then i would suggest adding the following to your babel config as well.
yarn add readable-stream
yarn add -D babel-plugin-rewrite-require
babel.config.js
module.exports = {
// rest of config
plugins: [
// other plugins
[
'babel-plugin-rewrite-require',
{
aliases: {
stream: 'readable-stream',
},
},
],
],
};
just install stream using npm install stream and run the project again.

Unable to build with electron-builder after migration from bower to yarn

I have an electron application using bower to resolve vendor deps and yarn for electron dependencies (node add-ons).
Because bower is deprecated I have migrated to yarn following this guide
how-to-migrate-away-from-bower
that uses bower-away
App launch fine but when I tried to build with electron-builder I got a problem with node module resolution.
$node_modules/.bin/build
• electron-builder version=20.8.1
• writing effective config file=dist/electron-builder-effective-config.yaml
Error: Unresolved node modules: angular, angular-animate, angular-aria, angular-messages, #bower_components/angular-translate, popper.js
at node_modules/electron-builder-lib/src/util/packageDependencies.ts:108:17
you should install of the package like this command
npm i angular --save
Use this answer: https://github.com/electron-userland/electron-builder/issues/2529#issuecomment-465185995
{
...
"dependencies": {
"bootstrap-vue": "^2.0",
"vue": "^2.6",
},
"optionalDependencies": {
"jquery": "1.9.1 - 3",
"popper.js": "^1.14.7"
}
}

{Help }New: Setting Up

I am trying to install and do the Hello World sample from Facebook.
I have 2 problems:
When I run: create-react-native-app AwesomeProject I get this error, What does this mean:
You are currently running Node v4.4.2 but create-react-native-app
requires >=6. Please use a supported version of Node.
My package.json: { "name": "AwesomeProject", "version": "0.1.0", "private": true, "scripts": { "test": "make test", "start": "node index.js" }, "devDependencies": { "react-native-scripts": "1.5.0" } }
When I npm start I get this error:
SyntaxError: Unexpected reserved word at exports.runInThisContext
(vm.js:53:16) at Module._compile (module.js:373:25) at
Object.Module._extensions..js (module.js:416:10) at Module.load
(module.js:343:32) at Function.Module._load (module.js:300:12) at
Function.Module.runMain (module.js:441:10) at startup (node.js:139:18)
at node.js:968:3
This is the code I copy and paste from Facebook Hello World sample.
Currently, you have'not clone AwesomeProject successful yet. You got the above error because you had older version of NodeJS (v4.4.2). Please follow step by step on below guidance:
Firstly, you need to install new one with version larger than 6.x.x (check and download it on the offical site).
Then, run create-react-native-app AwesomeProject again and make sure it is done with succesful message
Finally, run react-native start to launch the app.
Cheer!

Build error: missing babel-preset-expo in expo mobile app

I'm new to react-native and am in the early stages of creating an app with Expo. I had a working app 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:
Building JavaScript bundle: error
TransformError: ../app/main.js: Couldn't find preset "babel-preset-expo" relative to directory "../app/"
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.
I experienced this issue when I tried moving to expo version 21.0.0.
You should try to delete your node modules and use yarn to install.
package.json
dependencies:{
"babel-preset-expo" : "^4.0.0",
"expo": "^21.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-21-0.2.tar.gz"
}
my .babelrc
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}