Skip to content

Troubleshooting

Kelli Blalock edited this page Oct 19, 2016 · 6 revisions

Welcome!

This is aimed to be a walkthrough for some issues that people might encounter when trying to get started on this project. Hope it helps you out there! πŸ˜„

Troubles with node/npm/nvm

So it seems that node is a fickle thing. It demands a specific version of itself, a clear PATH, and a ton of luck.

If you're reading this, you're probably lacking at least one of these (or otherwise you're just super-thorough and going through the docs in their entirety πŸ‘!).

I've had myself a few troubles setting up node and its associates for the udacity-alumni app. I spent a while trying around.

But no(de) worries! 😜

Here are some steps that helped me get out of that ditch. I can't guarantee success. But maybe that ton of luck comes jetting up when properly drilling down on the issue.

I wrote this as a step-by-step guide. It's meant for people who (like me) don't really completely know what's going on. I hope that reading through this will help to get the issues sorted out. And maybe (like me) you'll even learn a bit on the way.

And writing it felt like a Choose your own Adventure story! πŸ˜„

So let's get started. πŸ‘‡

Try installing normally

Follow this guide - maybe things will work out just fine! πŸ€

Then try running the app locally

Do these final two steps and then open up your browser at http://0.0.0.0:1337.

Wait a little... aand? πŸŽ‰

If you can now see a pretty page, you're all set! Congrats. You're in peace and harmony with node.

In case of a white screen... oh well! Let's continue and try to get this working.

Where am I?

Make sure that you are inside of the alumni-client folder. If you're now wondering where this folder should have come from, take a sidestep to here (you'll need to do that first in order to run the app!)

Okay. The folder is here and you've got a shell window open, where entering pwd (=print working directory) returns the correct path ending with /alumni-client.

That's a good thing. Now we know where we are - and we're at the right spot! βœ…

Now try this again... (cautious optimism).

No? Error stuff?

Alright. Let's move forward.

Use nvm (=node version manager) explicitly

The repo contains a file called package.json. This file holds a lot of info regarding dependencies for running the project. I don't understand all of it myself, but here's a piece to focus on:

"engines": {
  "node": "5.2.0",
  "npm": "3.10.7"
},

Which means that the project uses node in its 5.2.0 version, and npm at version 3.10.7.

Yay! So what the third in the pack, nvm, does, is that it helps you to manage different versions of node. That's because node is very specific about these kinds of things.

We want to use the version mentioned in the package.json. If you tried the normal install, there's a command that starts with nvm and it utilizes exactly this information in the JSON file to decide which version of node and npm to run.

Now, for a change, let's be explicit. Try typing this into your shell:

nvm use 5.2.0

Can't be much more clear than that!

Try running npm run start again. (Because we haven't done this in a while, and you never know when the fountain of luck jets skywards!)

Nope?

Ok. Next try.

Let's wipe this thing clean

😱 (not your harddisk, no worries) πŸ˜…

node can produce some issues when being installed from different angles. Yep, that can happen, and yep... troubles...

I had a legacy node installation from some prehistoric times plus yet another one with the official downloadable installer (don't use that thing), and seems this made the setup too convoluted.

Here's a magic line to copy-paste into your shell, as a first try:

rm -rf node_modules && npm install

If this didn't work, we'll go about the whole process more thoroughly.

Let's track down all the files, delete them, and start anew. ✨

Here's a guide that worked well for me. Just follow these steps.

(I'll wait here in the meantime...)

Now, with a clean slate, let's loop back up to the beginning and try installing node using nvm and hope for the best!

If that works for you, it was nice having you read this and I wish you a great time dabbling into the alumni-app! πŸ˜„

Otherwise I'll meet you down here in a moment.

Onto a new PATH

Hei there, welcome back. Let's try something different.

Another issue that might prevent node from executing, could be that your PATH doesn't know where to find the executable node file.

The PATH is basically just a set of information on where executable files are located, and if node is not in there, it just won't run.

So here is something you can try to add it to the PATH (Check the answer, copy + paste).

And here's a video that deals with this in more detail. Just in case you need a break from trying and want to watch a little bit of youtube πŸ“Ί.

Hm... okay. I see... you're still here.

Time for the last approach I know about. Time for a big question:

Who am I? And what am I allowed to do?

Another source of nodey issues can come from permission problems.

This guide is short and effective. Give it a try.

You might not be who you think you are 😎 (type whoami into the shell), or you might not actually own your installation of node!

Strange this, I know. But do check it out.

🐚 πŸ’¬

Basically, if your shell responds with something like dwrxr or -rwxr at the beginning, and then your username, then the permissions should be fine.

Rejoice! node is after all your 🏰!

Otherwise you'll need to fix the permissions:

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Ahem... But it's still not working...

Oh, right! Okay, seems I'm slowly running out of suggestions...

Here's a good Resource that has a few very short ways to try to (re)install node. I personally tried the first one and it gave me good results.

Ahem...

Still not? Ah!

Ok. I guess now it's time to send a message to Ryan... 😜


Good luck and don't be put down if it didn't work out! You'll eventually get it to work, just don't give up πŸ˜„

And if you figure out a new way to make the node-luck flow, do add a section to this document!

Errors and Fixes

webpack missing

Error: Cannot find module 'webpack'

-> Fix

npm install -g webpack-dev-server webpack

nvm/npm/node not found

If commands like node -v (which checks for node's version) returns an error.

-> Fix

Try to go through the steps mentioned above. Good luck!

wrong repo

scalable-react-boilerplate@1.1.0 anywhere in the Error message

-> Fix

That's the wrong repo. Clone the correct one from here, like that:

git clone https://github.com/udacityalumni/alumni-client