Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while doing the project setup #492

Closed
mridubhatnagar opened this issue Aug 21, 2021 · 4 comments
Closed

Error while doing the project setup #492

mridubhatnagar opened this issue Aug 21, 2021 · 4 comments

Comments

@mridubhatnagar
Copy link

I am trying to set up the project on my local system based on the steps mentioned in the repository's README.md file but I am facing the following issue when I am trying to access the web applications URL. I am able to access the admin panel though.

Can you guide me on how to do the project setup?

Screenshot from 2021-08-21 21-29-03

@sagesharp
Copy link
Collaborator

I think that error occurs when either you didn't install the npm packages, or you didn't run the manage.py runserver command with the npm package prefix. Please tell me exactly what commands you ran before you got this error.

@mridubhatnagar
Copy link
Author

mridubhatnagar commented Aug 26, 2021

@sagesharp I followed the steps as mentioned in the README.md file.

Did npm install, created virtual environment using pipenv, activated pipenv shell. After activating the pipenv shell ran python manage.py migrate followed by python manage.py runserver

@sagesharp
Copy link
Collaborator

sagesharp commented Aug 31, 2021

@mridubhatnagar You did almost all the right steps! For the last command, the README.md says that you need to run this command:

PATH="$PWD/node_modules/.bin:$PATH" ./manage.py runserver

That first part of the command does something very important. Leaving it off caused the error you encountered. I'll explain why below. If you already know these things, no worries! I just want to make sure other people who run into this error understand what's happening.

You installed some node.js packages with the command npm install. The packages got installed in a local directory in your git repository (node_modules/.bin). A package includes a set of executable files. Setting the "execute" property on a file means it's a program that your computer can execute (run).

You've executed (run) commands in a window called a shell (or terminal). Those commands included things like the npm install command you ran.

Running a command in your shell is actually a short cut -- the shell finds an executable file with that command name, runs it with the arguments you passed, and displays the output from the program on your shell window.

So, running a command actually runs an executable file. Where are these executable files normally stored? You can find out where the executable file for a command is stored by running which. For example, you can find out where the executable file for the ls command is stored:

$ which ls
/bin/ls

So the ls command is an executable file in the directory /bin/.

Executable files can be in many different directories on your computer. By default, the shell looks in a specific set of directories for executable files.

The shell doesn't know that it needs to search the local directory node_modules/.bin/ for executable files. So when it tries to execute a node.js package command, like postcss, it doesn't find the postcss executable file in the default set of directories. And you get the error "/bin/sh postcss not found".

So we need to tell the shell about this new "directory path" to the node.js executable files. That's what the first part of this command does:

PATH="$PWD/node_modules/.bin:$PATH" ./manage.py runserver

It's basically giving the shell a hint, saying, "look here for the executable files for any command you want to run."

This blog post has a good write up for what a shell "path" is.

I hope this helps! Let me know if you run into any more issues.

@sagesharp
Copy link
Collaborator

sagesharp commented Aug 31, 2021

Ah, I thought of one more thing that might be an issue. You will also need to make sure you run the command while in your git repository. That may mean you need to change directories, as sometimes invoking a virtual environment can cause you to change directories. But if the migrate command succeeded, you're probably in the correct directory.

If you still have trouble after trying the command in my first comment, please copy and paste your full output from your shell window, including the commands and where you are running them.

@outreachy outreachy locked and limited conversation to collaborators Aug 31, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants