unable to resolve "react-native-gesture-handler" from "node_modules/#react-navigation/native/src/Scrollables.js"
E:\>npm install react-native-gesture-handler --save
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/naver/hammer.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2020-02-13T05_04_32_3
58Z-debug.log
I just found the solution of this problem ..
It's Just version Error
npm install react-native-gesture-handler#1.3.0
When I try this
It's Working
In your scenario I think you haven't install the gesture handler package.
For more information on React Native Gesture Handler please visit here
SOLUTION
Inside your project root folder run this code :
If you are using npm - npm install --save react-native-gesture-handler
If you are using yarn - yarn add react-native-gesture-handler
Once you have installed above package run your project using react-native run
If you still getting errors open cmd via administrator and run above code
Cause
Some some reason, autolinking is not working and had to manually link packages in both IOS and android.
Specs
"react": "17.0.1",
"react-native": "0.64.2",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.5",
"react-native-gesture-handler": "^1.10.3",
Solution
put import 'react-native-gesture-handler'; at the top of the app.js or index.js
Android
Step 1
implementation project(':react-native-gesture-handler') in app/build.gradle file inside dependencies {} block.
Step 2
in MainActivity.java
package com.myapp;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
#Override
protected String getMainComponentName() {
return "myapp";
}
#Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
#Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
Step 3
add import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; in MainApplication.java also add packages.add(new RNGestureHandlerPackage()); in getPackages() function like below
#Override
protected List<ReactPackage> getPackages() {
#SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new MapsPackage());
packages.add(new VectorIconsPackage());
packages.add(new RNGestureHandlerPackage());
return packages;
}
Step 4
add following in settings.gradle file
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-gesture-handler/android')
Note: Make necessary adjustments for ../../../ in your case it can be ../ because I am using monorepo concept.
delete node_modoules
run npm install --save react-native-gesture-handler (additional android setup here - https://software-mansion.github.io/react-native-gesture-handler/docs/getting-started.html)
Bare React Native#
yarn add react-native-gesture-handler
** Update your MainActivity.java file **
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
Related
**THE ERROR **
This issue is given below. It compiled successfully using "npx hardhat compile" but whenever i try to run it using "npx hardat run scripts/deploy.js --network rinkeby" it is showing me the error. Solution for this error is not given anywhere. Please help!!!
X:\Projects\twitter-web3\smartContracts> npx hardat run scripts/deploy.js --network rinkeby
npm ERR! 404
npm ERR! 404 'hardat#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\niken\AppData\Roaming\npm-cache\_logs\2022-05-29T15_39_19_531Z-debug.log
Install for [ 'hardat#latest' ] failed with code 1
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/hardat - Not found
npm ERR! 404
npm ERR! 404 'hardat#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\niken\AppData\Roaming\npm-cache\_logs\2022-05-29T15_41_17_035Z-debug.log
Install for [ 'hardat#latest' ] failed with code 1
THE FILES-
MintProfileImage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "#openzeppelin/contracts/token/ERC721/ERC721.sol";
import "#openzeppelin/contracts/access/Ownable.sol";
import "#openzeppelin/contracts/utils/Counters.sol";
contract ProfileImageNfts is ERC721, Ownable {
using Counters for Counters.Counter;
using Strings for uint256;
Counters.Counter _tokenIds;
mapping(uint256 => string) _tokenURIs;
struct RenderToken {
uint256 id;
string uri;
string space;
}
constructor() ERC721("ProfileImageNfts", "PIN") {}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
_tokenURIs[tokenId] = _tokenURI;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "URI not exist on that ID");
string memory _RUri = _tokenURIs[tokenId];
return _RUri;
}
function getAlltoken() public view returns (RenderToken[] memory) {
uint256 latestId = _tokenIds.current();
RenderToken[] memory res = new RenderToken[](latestId);
for (uint256 i = 0; i <= latestId; i++) {
if (_exists(i)) {
string memory uri = tokenURI(i);
res[i] = RenderToken(i, uri, " ");
}
}
return res;
}
function mint(address recipents, string memory _uri)
public
returns (uint256)
{
uint256 newId = _tokenIds.current();
_mint(recipents, newId);
_setTokenURI(newId, _uri);
_tokenIds.increment();
return newId;
}
}
Package.json
{
"name": "hardhat-project",
"devDependencies": {
"#nomiclabs/hardhat-ethers": "^2.0.4",
"#nomiclabs/hardhat-waffle": "^2.0.2",
"chai": "^4.3.6",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.4",
"hardhat": "^2.8.3"
},
"dependencies": {
"#openzeppelin/contracts": "^4.4.2"
}
}
Im trying to setup a next js with native base and following the instructions, I am getting this.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: next-latest#undefined
npm ERR! Found: next#12.0.4
npm ERR! node_modules/next
npm ERR! next#"12.0.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer next#"^11" from #expo/next-adapter#3.1.10
npm ERR! node_modules/#expo/next-adapter
npm ERR! dev #expo/next-adapter#"^3.1.10" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Zacha\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Zacha\AppData\Local\npm-cache\_logs\2022-01-20T00_16_08_660Z-debug-0.log
Aborting installation.
npm install has failed.
Try Following Steps.
Downgrade your next to 11
npm install next#11
Changes next.config.js to following code.
const { withExpo } = require('#expo/next-adapter');
const withPlugins = require('next-compose-plugins');
const withTM = require('next-transpile-modules')([
'native-base',
'react-native-svg',
'react-native-safe-area-context',
'#react-aria/visually-hidden',
'#react-native-aria/button',
'#react-native-aria/checkbox',
'#react-native-aria/combobox',
'#react-native-aria/focus',
'#react-native-aria/interactions',
'#react-native-aria/listbox',
'#react-native-aria/overlays',
'#react-native-aria/radio',
'#react-native-aria/slider',
'#react-native-aria/tabs',
'#react-native-aria/utils',
'#react-stately/combobox',
'#react-stately/radio',
]);
module.exports = withPlugins(
[withTM, [withExpo, { projectRoot: __dirname }], { webpack5: true }],
{
webpack: config => {
config.resolve.alias = {
...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web`
'react-native$': 'react-native-web',
};
config.resolve.extensions = [
'.web.js',
'.web.ts',
'.web.tsx',
...config.resolve.extensions,
];
return config;
},
}
);
Add import React from 'react'; to _app.js.
I am trying to pack an npm package and install it on my webapp.
My application has the following structure:
app
app.ts
app.css
build
app.js
app.css
package.json
tsconfig.json
.npmignore
I started with the pack command documentation.
I added the .npmignore to include only the build folder.
As expected when running npm pack, I know have a new app-1.0.0.tgz
When I try to install it in the web app with npm install ..\typescriptapp\typescriptapp-1.0.0
I get the following error:
npm ERR! code ENOLOCAL
npm ERR! Could not install from
"..\typescriptapp-1.0.0" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\corbin\AppData\Roaming\npm-cache_logs\2018-03-26T17_49_30_440Z-debug.log
However when I unzip the typescriptapp.tgz, I have the following structure
typecriptapp-1.0.0
typecriptapp-1.0.0
package
build
app.js
app.css
package.json
tsconfig.json
Here is my package.json file:
{
"name": "typescriptapp",
"version": "1.0.0",
"scripts": {
"build": "tsc",
"debug": "tsc -w"
},
"devDependencies": {
"#types/signalr": "2.2.35",
"uglify-js": "3.3.16",
"uglifycss": "0.0.28"
},
"dependencies": {
"#aspnet/signalr": "^1.0.0-preview1-update1",
"lib": "file:../references/lib"
}
}
What am I doing wrong?
You are trying to run install in the parent folder
npm install ..\typescriptapp\typescriptapp-1.0.0
Whereas you have to install it in
npm install ..\typescriptapp\typescriptapp-1.0.0\typescriptapp-1.0.0\package
I have installed a few modules doing npm install --save ng2-redux redux redux-actions redux-promise. If I do npm list | grep "redux" I get:
├── ng2-redux#3.0.5
├─┬ redux#3.5.2
├─┬ redux-actions#0.12.0
├─┬ redux-promise#0.5.3
And in my package.json I can find them as well:
"dependencies": {
...
"ng2-redux": "3.0.5",
"redux": "3.5.2",
"redux-actions": "0.12.0",
"redux-promise": "0.5.3",
...
}
The problem is that while ng2-redux and redux both work fine:
import { applyMiddleware } from 'redux';
import { NgRedux, select } from 'ng2-redux';
redux-actions and redux-promise both throw a Cannot resolve file 'redux-actions'/'redux-promise' when trying to import them, that appears both in the IDE (WebStorm 11.0.4) and in Webpack:
import { createAction } from 'redux-actions';
import promiseMiddleware from 'redux-promise';
The errors says:
ERROR in ../src/.../app.component.ts
(8,31): error TS2307: Cannot find module 'redux-promise'.
However...
import 'redux-actions';
import 'redux-promise';
...works just fine.
I have already tried to remove the node_modules folder and reinstall everything with npm cache clear, rm -rf node_modules and npm install and it doesn't fix the problem.
You should also have d.ts file under node_modules directory. Try
npm install --save-dev #types/redux-promise
to acquire the type information of the module.
npm install doesn't seem to work if I depend on a local package that itself depends on another local package. I'm using npm version 2.5.1.
Here's what I have:
package.json for /src/modules/moduleA:
{
"name": "moduleA",
"version": "0.0.1",
...
"dependencies": {
"bluebird": "^2.9.1",
"nodemailer": "^1.3.0"
}
}
package.json for /src/modules/moduleB:
{
"name": "moduleB",
"version": "1.0.0",
...
"dependencies": {
"nconf": "~0.6.7",
"moduleA": "../moduleA"
}
}
package.json for /src/apps/coolApp:
{
"name": "coolApp",
"version": "1.0.0",
...
"dependencies": {
"mysql": "~2.4.2",
"request": "~2.40.0",
"cheerio": "~0.17.0",
"async": "~0.9.0",
"expand-url": "0.1.3",
"moduleB": "../../modules/moduleB"
}
}
Now if I try to npm install :
cd /src/modules/moduleA
npm install
[success, yay!]
cd /src/modules/moduleB
npm install
[success, yay!]
cd /src/apps/coolApp
npm install
npm ERR! addLocal Could not install /src/node/apps/moduleA
npm ERR! enoent ENOENT, open '/src/node/apps/moduleA'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
[oh no!]
For some reason, npm is trying to install moduleA for coolApp, even though it doesn't need to directly, and also, it is using the relative path string as it is literally specified in the package.json file for moduleB, even though that isn't valid for coolApp since it is in a relatively different location.
I found that if you specify the local modules with "file:" before the path, everything works fine. Yay
Like this:
"moduleB": "file:../../modules/moduleB"