Installing an npm Library in an Existing React Native App





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















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 run npm
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"
}
}









share|improve this question




















  • 1





    Try "react-native": "0.57.0"

    – Chanaka
    Jan 3 at 4:43






  • 1





    How do you mean? When do I try this?

    – Devin Miller
    Jan 3 at 11:11











  • You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

    – Chanaka
    Jan 3 at 11:27













  • I have made this change in my package.json and then ran npm install twit and the same issue persists

    – Devin Miller
    Jan 3 at 14:02


















1















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 run npm
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"
}
}









share|improve this question




















  • 1





    Try "react-native": "0.57.0"

    – Chanaka
    Jan 3 at 4:43






  • 1





    How do you mean? When do I try this?

    – Devin Miller
    Jan 3 at 11:11











  • You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

    – Chanaka
    Jan 3 at 11:27













  • I have made this change in my package.json and then ran npm install twit and the same issue persists

    – Devin Miller
    Jan 3 at 14:02














1












1








1








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 run npm
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"
}
}









share|improve this question
















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 run npm
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"
}
}






javascript reactjs api react-native npm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 3:17







Devin Miller

















asked Jan 3 at 2:37









Devin MillerDevin Miller

577




577








  • 1





    Try "react-native": "0.57.0"

    – Chanaka
    Jan 3 at 4:43






  • 1





    How do you mean? When do I try this?

    – Devin Miller
    Jan 3 at 11:11











  • You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

    – Chanaka
    Jan 3 at 11:27













  • I have made this change in my package.json and then ran npm install twit and the same issue persists

    – Devin Miller
    Jan 3 at 14:02














  • 1





    Try "react-native": "0.57.0"

    – Chanaka
    Jan 3 at 4:43






  • 1





    How do you mean? When do I try this?

    – Devin Miller
    Jan 3 at 11:11











  • You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

    – Chanaka
    Jan 3 at 11:27













  • I have made this change in my package.json and then ran npm install twit and the same issue persists

    – Devin Miller
    Jan 3 at 14:02








1




1





Try "react-native": "0.57.0"

– Chanaka
Jan 3 at 4:43





Try "react-native": "0.57.0"

– Chanaka
Jan 3 at 4:43




1




1





How do you mean? When do I try this?

– Devin Miller
Jan 3 at 11:11





How do you mean? When do I try this?

– Devin Miller
Jan 3 at 11:11













You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

– Chanaka
Jan 3 at 11:27







You use "react-native": "0.57.8". Try to "react-native": "0.57.0". It may be work.

– Chanaka
Jan 3 at 11:27















I have made this change in my package.json and then ran npm install twit and the same issue persists

– Devin Miller
Jan 3 at 14:02





I have made this change in my package.json and then ran npm install twit and the same issue persists

– Devin Miller
Jan 3 at 14:02












1 Answer
1






active

oldest

votes


















0














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.




  1. Go to package.json file and under the dependency delete react-native-twitter@0.2.1

  2. Then delete your node file.

  3. type cmd npm install

  4. Then react-native run-android


Now you can run your app in previous version.






share|improve this answer
























  • Provided in edits

    – Devin Miller
    Jan 3 at 3:17












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015628%2finstalling-an-npm-library-in-an-existing-react-native-app%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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.




  1. Go to package.json file and under the dependency delete react-native-twitter@0.2.1

  2. Then delete your node file.

  3. type cmd npm install

  4. Then react-native run-android


Now you can run your app in previous version.






share|improve this answer
























  • Provided in edits

    – Devin Miller
    Jan 3 at 3:17
















0














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.




  1. Go to package.json file and under the dependency delete react-native-twitter@0.2.1

  2. Then delete your node file.

  3. type cmd npm install

  4. Then react-native run-android


Now you can run your app in previous version.






share|improve this answer
























  • Provided in edits

    – Devin Miller
    Jan 3 at 3:17














0












0








0







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.




  1. Go to package.json file and under the dependency delete react-native-twitter@0.2.1

  2. Then delete your node file.

  3. type cmd npm install

  4. Then react-native run-android


Now you can run your app in previous version.






share|improve this answer













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.




  1. Go to package.json file and under the dependency delete react-native-twitter@0.2.1

  2. Then delete your node file.

  3. type cmd npm install

  4. Then react-native run-android


Now you can run your app in previous version.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 3 at 2:48









ChanakaChanaka

35339




35339













  • Provided in edits

    – Devin Miller
    Jan 3 at 3:17



















  • Provided in edits

    – Devin Miller
    Jan 3 at 3:17

















Provided in edits

– Devin Miller
Jan 3 at 3:17





Provided in edits

– Devin Miller
Jan 3 at 3:17




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015628%2finstalling-an-npm-library-in-an-existing-react-native-app%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

ts Property 'filter' does not exist on type '{}'

mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window