'expo'/'react-native'/'react-native-render-html'/'react-navigation' dependency is not installed - react-native

watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install
I tried a lot of times to reinstall these dependncies, but everytime when I run
exp start -c
I have following warnings
01:22:43 [exp] Warning: 'expo' dependency is not installed.
01:22:43 [exp] Warning: 'react-native' dependency is not installed.
01:22:43 [exp] Warning: 'react-native-render-html' dependency is not installed.
this is my package.json
{
"name": "Real300",
"version": "0.7.2",
"private": true,
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-flow": "^6.23.0",
"flow-bin": "^0.58.0",
"flow-remove-types": "^1.2.3",
"jest-expo": "^26.0.0",
"react-test-renderer": "16.0.0"
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"test": "node node_modules/jest/bin/jest.js --watch",
"prepublish": "yarn run build",
"flow": "flow"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/samples": "2.1.1",
"#expo/vector-icons": "^6.1.0",
"buffer": "^5.0.8",
"expo": "26.0.0",
"global": "^4.3.2",
"iconv-lite": "^0.4.19",
"install": "^0.10.1",
"native-base": "^2.3.2",
"npm": "^5.5.1",
"prop-types": "^15.6.0",
"react": "16.3.0-alpha.1",
"react-dom": "^16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
"react-native-camera-roll-picker": "^1.2.3",
"react-native-cli": "^2.0.1",
"react-native-dimension": "^1.0.6",
"react-native-easy-grid": "^0.1.15",
"react-native-elements": "^0.17.0",
"react-native-fs": "^2.8.5",
"react-native-image-crop-picker": "^0.18.1",
"react-native-image-picker": "^0.26.7",
"react-native-material-cards": "^1.0.7",
"react-native-material-ui": "^1.14.0",
"react-native-navigation": "^1.1.257",
"react-native-render-html": "^3.7.0",
"react-native-router-flux": "4.0.0-beta.22",
"react-native-sglistview": "^0.4.3",
"react-native-swiper": "^1.5.13",
"react-native-tab-view": "0.0.70",
"react-native-viewpager": "^0.2.13",
"react-navigation": "^1.5.8",
"stream": "0.0.2",
"sudo": "^1.0.3",
"tcomb-form-native": "^0.6.11"
}
}
My project have ejected with expo kit and I am following instruction of the eject screen. It was working fine before ejection but now I cannot let my code run.
I build my codes in Xcode and it was successfully. I can run simulator but I can see nothing from it, just white screen. Expect I have a red banner on the bottom with those "dismiss""reload""copy""more info". I try to copy but nothing goes to my clipboard.
the repo of my ejection is:
1. npm run eject
2. choose expoKit
3. waiting for it to eject
4. updated expo sdk to 26
5. change react native to expo fork
6. pod install
did I miss something?

Case closed.
I have to update yarn to the newest version and npm is not gonna work.
after update yarn to 1.6, everything is good now.

Related

Unable to resolve module multer

I'm getting an error when a run my react-native project in Android device.
I already tried many things. Remove node_modules, clear npm cache, yarn too, use yarn and npm to install, and don't resolve it.
What is happening?
Error: Unable to resolve module `util` from `node_modules/multer/lib/multer-error.js`: util could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
Already tried the suggestions indicated in the error message too.
package.json
{
"name": "svm",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/datetimepicker": "^2.3.2",
"#react-native-community/masked-view": "^0.1.6",
"#react-navigation/drawer": "^5.4.0",
"axios": "^0.19.2",
"formik": "^2.1.4",
"moment": "^2.24.0",
"native-base": "^2.13.8",
"react": "16.9.0",
"react-native": "^0.62.2",
"react-native-elements": "^1.2.7",
"react-native-ftp": "^1.0.1",
"react-native-gesture-handler": "^1.5.6",
"react-native-image-picker": "^2.3.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-masked-text": "^1.13.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.2",
"react-native-screens": "^2.0.0-beta.2",
"react-native-sound": "^0.11.0",
"react-native-vector-icons": "^6.6.0",
"react-native-youtube": "^2.0.1",
"react-navigation": "^4.1.1",
"ssh2-sftp-client": "^5.1.2",
"styled-components": "^5.0.1",
"yup": "^0.28.1"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"multer": "^1.4.2",
"multer-sftp": "^1.1.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Multer is listed as dev dependency. I guess you have build the app for production when testing it. So the package is not loaded.
Moving the "multer": "^1.4.2" dependency to "dependencies" from "devDependencies" should probably resolve it.

React native version mismatch after upgrading to 0.61.1 in brand new project

I am upgrading my React Native app from 0.59 to 0,61. What I did was to generate a brand new project from ground up with react-native init emps_fe6 and yarn add each module in package.json. Also copy the components and App.js over to the new project. Here is my new package.json file:
{
"name": "emps_fe6",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.6.2",
"moment": "^2.24.0",
"react": "16.9.0",
"react-native": "0.61.1",
"react-native-cli": "^2.0.1",
"react-native-confirmation-code-field": "^3.9.0",
"react-native-device-info": "^3.1.4",
"react-native-elements": "^1.2.3",
"react-native-gesture-handler": "^1.4.1",
"react-native-gifted-chat": "^0.10.1",
"react-native-keychain": "^4.0.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-modal": "^11.4.0",
"react-native-modal-datetime-picker": "^7.6.0",
"react-native-segmented-control-tab": "^3.4.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.0.10",
"socket.io-client": "2.1.1"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Then start on Android emulator with react-native run-android. It throws out the error of version mismatch:
I don't quite understand what causes the error, as there is no reference to version 0.59.9 in components and App.js copied. The project is started from brand new and each module is yarn add individually. Only thing from previous version is the components and App.js.
Maybe you had metro bundler running with a previous version of React Native which caused this issue. So, what I typically do when I face this problem is to start the bundler like npm start --reset-cache. Make sure to stop any metro bundler running.
If problem persist try restarting your machine.

Expo react native peer dependency

I am getting issue since expo sdk 28 upgrade.
Warning: 'react-native' peer dependency missing. Run npm ls in /Users/macbook/Desktop/eventlinn to see full warning.
Warning: 'react' peer dependency missing. Run npm ls in /Users/macbook/Desktop/eventlinn to see full warning.
My package.json like this
"dependencies": {
"#expo/samples": "2.1.1",
"axios": "^0.18.0",
"expo": "^28.0.0",
"impagination": "^1.0.0-alpha.3",
"moment": "^2.22.2",
"native-base": "^2.7.1",
"pod": "^0.9.0",
"react": "^16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz",
"react-native-camera": "^1.1.4",
"react-native-datepicker": "^1.7.2",
"react-native-dismissable-numeric-keyboard": "^0.1.0",
"react-native-elements": "^0.19.1",
"react-native-fcm": "^6.2.3",
"react-native-firebase": "^4.2.0",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-google-places": "^2.5.2",
"react-native-keyboard-aware-scroll-view": "^0.6.0",
"react-native-modal-datetime-picker": "^5.1.0",
"react-native-modal-dropdown": "^0.6.2",
"react-native-modal-picker": "0.0.16",
"react-native-modal-selector": "0.0.27",
"react-native-select-input-ios": "^1.2.0",
"react-navigation": "~2.3.1",
"react-timer-mixin": "^0.13.3",
"util": "^0.10.3",
"watchman": "^1.0.0",
"yarn": "^1.7.0"
}
First update your dependencies version from below dependencies then add your additional required dependencies in that from yours:
{
"name": "nativebasedemo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
"newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
"test:watch": "jest --watch",
"lint": "eslint ./App",
"lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
"fixcode": "eslint --fix ./App",
"git-hook": "npm run lint -s && npm run test -s",
"rm-node": "rm -rf node_modules && npm install"
},
"dependencies": {
"lodash": "^4.17.10",
"native-base": "^2.4.4",
"prop-types": "^15.6.1",
"react": "16.3.2",
"react-native": "^0.55",
"react-native-easy-grid": "^0.2.0",
"react-navigation": "2.2.5"
},
"devDependencies": {
"babel-core": "6.26.0",
"babel-eslint": "^8.2.5",
"babel-jest": "22.4.3",
"babel-plugin-ignite-ignore-reactotron": "^0.3.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react-native": "^3.0.2",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"jest": "22.4.3"
},
"jest": {
"testMatch": [
"<rootDir>/Tests/**/*.js",
"**/?(*.)(spec|test).js?(x)"
],
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/Tests/Setup.js"
],
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
},
"setupFiles": [
"<rootDir>/Tests/Setup"
],
"preset": "react-native"
}
}
I had a similar issue, with both react and react-native.
Ended up locking down native-base version to 2.6.1.
This way, native-base doesn't ask for higher versions, which sdk-28.0.0.tar.gz doesn't have.

NPM does not install dependencies

There are a handful of other questions on here, but none that seem to be the same problem.
Running npm install on a preexisting package.json, pulled in from git, does all of its processing, creates a node_modules directory, then ends without installing the modules. node_modules is empty, and there were no errors (just a couple warnings about deprecated modules). The entire directory is owned by the active user.
After a bunch of messing around, I've found that if I remove all of the devDependencies, the normal dependencies will install as expected.
OS: Ubuntu 16.04
Node: 6.9.1
NPM: 3.10.8
package.json:
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon --ignore src --ignore public --ignore views",
"test": "node ../app.js"
},
"author": "xxx",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^6.5.1",
"babel-preset-es2015": "^6.18.0",
"babelify": "^7.3.0",
"browserify": "^13.1.1",
"chalk": "^1.1.3",
"event-stream": "^3.3.4",
"fs-extra": "^1.0.0",
"git-guppy": "^1.2.1",
"glob": "^7.1.1",
"gulp": "^3.9.1",
"gulp-cssnano": "^2.1.2",
"gulp-duration": "0.0.0",
"gulp-filter": "^4.0.0",
"gulp-function": "^2.2.0",
"gulp-git": "^1.12.0",
"gulp-livereload": "^3.8.1",
"gulp-notify": "^2.2.0",
"gulp-postcss": "^6.2.0",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"guppy-pre-commit": "^0.4.0",
"postcss-cssnext": "^2.8.0",
"postcss-math": "0.0.5",
"precss": "^1.4.0",
"q": "^1.4.1",
"utils-merge": "^1.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
"dependencies": {
"axios": "^0.15.2",
"dotenv": "^2.0.0",
"express": "^4.14.0",
"fs": "0.0.1-security",
"git-rev-sync": "^1.8.0",
"pug": "^2.0.0-beta6",
"yamljs": "^0.2.8"
}
}
This is running on a basic DO server, the same distribution I've spun up for a dozen other projects, with no problem. The only thing I can think of is if there's something within one of the devDependencies that is clogging things up. How to debug this?
It appears that "fs" is not a valid npm package. I came to this conclusion after running this command:
npm bugs fs
This ended up displaying bugs filed against a npm/security-holder package. It appears that the "fs" on NPM may have been malicious.
If you want node's fs package, you don't need an entry in your package.json for that, fs is built-in.

npm install dosen't install dev dependencies

I have a project where I use npm for handling dependencies. The project is bundled with Webpack and will run on the client (it's built for using gh-pages for hosting) with no production dependencies. Therefore I have only devDependencies in my package.json. However, when I run npm install nothing gets installed. When I run npm install --dev my dependencies gets installed as they are supposed to. Since --dev is deprecated I tried with npm install --only=dev as well, however nothing gets installed then either! Is there something broken in my package.json (inserted below) or am I misunderstanding npm?
{
"name": "Boilerplate",
"version": "0.0.1",
"description": "A boilerplate to quickly get started with an offline first React/Redux app",
"repository": {
"type": "git",
"url": "https://github.com/OskarKlintrot/Offline-First-React-And-Redux-Boilerplate"
},
"scripts": {
"start": "webpack-dev-server",
"build": "webpack --progress --colors --production"
},
"private": true,
"devDependencies": {
"babel-core": "^6.2.1",
"babel-eslint": "^4.0.5",
"babel-loader": "^6.2.0",
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-1": "^6.1.18",
"eslint": "^1.1.0",
"eslint-loader": "^1.0.0",
"eslint-plugin-react": "^3.13.1",
"file-loader": "^0.8.5",
"history": "^1.17.0",
"react": "^0.14.2",
"react-dom": "^0.14.2",
"react-hot-loader": "^1.3.0",
"react-mdl": "^1.0.2",
"react-redux": "^4.0.4",
"react-router": "^1.0.2",
"react-tap-event-plugin": "^0.2.1",
"redux": "^3.0.5",
"redux-devtools": "^3.0.0",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.1",
"redux-history-transitions": "^1.0.0",
"redux-thunk": "^1.0.2",
"transfer-webpack-plugin": "^0.1.4",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
}
}