Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKarl Charles
1,786 Pointsunable to run on react-native-app with npm 5.x!!
When I run the command: create-react-native-app, i got this error:
ERROR: npm 5 is not supported yet
It looks like you're using npm 5 which was recently released.
Create React Native App doesn't work with npm 5 yet, unfortunately. We recommend using npm 4 or yarn until some bugs are resolved.
You can follow the known issues with npm 5 at: https://github.com/npm/npm/issues/16991
I've tried installing version 4.x but when I try to run the command nm start, it still gives me errors :/
An updated guide would be perfect :)
Thanks in advance.
3 Answers
Ari Misha
19,323 PointsWell as suggested by npm log in the console , you're gonna have to install watchman as dev dependency. Watchman watch all the changes with your files, and rebuild all the assets and dependencies when changes happens. Create a file named .watchmanconfig in order to configure watchman in your project. This is how your .watchmanconfig file to should look like:
{
"root_files": [".watchmanconfig"]
}
There is a lot more you could do with watchman, for further info visit here. Also dont forget to git init
in your project coz watchman requires .git in your root project. I hope this helped!
~ Ari
Ari Misha
19,323 PointsHiya there! Why not install yarn? Yarn is also a package manager and you can achieve pretty much the same thing with yarn. NPM has few bugs and sometimes dependencies dont play well with each other. But yarn will rescue you.
Install yarn with following command:
$ brew install yarn --without-node
OR
sudo port install yarn
For windows , you can visit here.
For Linux and Ubuntu, try this in your terminal:
sudo apt-get update && sudo apt-get install yarn
After installation part, try yarn --version
in your terminal. If everything goes well, you'll see the version number. But if it doesnt , try to set path variable to set yarn globally with this command in your terminal :
export PATH="$PATH:`yarn global bin`" //notice the backticks
Now, try to run your project with yarn with the following command in your terminal :
yarn run
And for further help or additional commands using yarn , try this in your terminal yarn -h
. I hope it helped!
~ Ari
Karl Charles
1,786 PointsHi Ari
No, I'm afraid this did not solve the issue. There may be a problem with my machine but its only 3 months old :/
is there anything else that you know could be the problem?
Thanks Karl
Ari Misha
19,323 PointsMaybe uninstall Node from your machine and re-install the stable and newest version of Node. Also what kinda error does your terminal throws?
Karl Charles
1,786 PointsI'll try reinstalling now. But this is what I'm getting back:
GR-00172:AwesomeProject kcharles$ npm start
AwesomeProject@0.1.0 start /Users/kcharles/Documents/Apps/TeamTreeHouse/React Native App/AwesomeProject react-native-scripts start
2:34:08 PM: Unable to start server See https://git.io/v5vcn for more information, either install watchman or run the following snippet: sudo sysctl -w kern.maxfiles=5242880 sudo sysctl -w kern.maxfilesperproc=524288
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AwesomeProject@0.1.0 start: react-native-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AwesomeProject@0.1.0 start 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/kcharles/.npm/_logs/2017-11-07T14_34_08_608Z-debug.log
Ari Misha
19,323 PointsAlright! I see! Can you show me your package.json file?
Karl Charles
1,786 Points{
"name": "AwesomeProject",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.7.0",
"jest-expo": "^22.0.0",
"react-test-renderer": "16.0.0-beta.5"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^22.0.2",
"react": "16.0.0-beta.5",
"react-native": "^0.49.5"
}
}
Karl Charles
1,786 PointsKarl Charles
1,786 PointsYes! thank you, Ari.
This method fixed the issue.