I am trying to install libraries from npmjs.com and save them as dependencies on my existing react native app. Installation instruction say to write npm install twit
in terminal. So, in VScode, with the application open, I enter this in the terminal. After installation, the terminal will say something like:
+ react-native-twitter@0.2.1
added 3 packages, removed 945 packages and updated 1 package in 14.238s
Now I cannot run the application on the android simulator etc.
Can someone explain what I may be doing wrong and what kinds of libraries I can/cannot add? For example, must the library be built specifically for react/react native?
Thanks
error when running simulator:
react-native run-android
Command
run-android
unrecognized. Make sure that you have runnpm install
and that you are inside a react-native project.npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AwesomeProject@0.0.1 android:
react-native run-android
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AwesomeProject@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/admin/.npm/_logs/2019-01-03T03_13_17_686Z-debug.logPackage.json:
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"ios": "react-native run-ios",
"android": "react-native run-android"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-twitter": "^0.2.1"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.5",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
Can you tell the error when you run app in simulator?
Add your package.json file. It may be more helpful to find the answer.
You can recovery it using following step.
Now you can run your app in previous version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.