Skip to content
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 running the project locally #216

Open
1 of 2 tasks
nighto opened this issue Oct 4, 2023 · 6 comments
Open
1 of 2 tasks

Error running the project locally #216

nighto opened this issue Oct 4, 2023 · 6 comments
Labels

Comments

@nighto
Copy link

nighto commented Oct 4, 2023

Hi all. First of all, thanks a lot for this project, I use it almost every day. I would like to contribute with some tasks which I think I can implement such as #213, but I could not run the project on my machine.

Describe the bug
Write a clear and concise description of the bug.

Steps to reproduce

  1. Cloned the project on my machine (already have npm, yarn etc. installed)
  2. Ran yarn, all dependencies were successfully installed
  3. Created an Last.fm API key & secret, copied .env to .env.development.local as described on README.md
  4. Tried running yarn start and it failed. Both yarn start:server and yarn start:services yielded different errors, which I will copy the output below.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem (link them or drag and drop them into the issue to upload)

Device

  • Desktop
  • Mobile

Platform (please complete the following information):

  • Operating system (name and version): Windows 11, running commands on PowerShell
  • Browser (name and version): not relevant
  • Version (see footer of website): code on main branch as of today

Additional context
Add any other context about the problem here.

  • yarn output is (just double checking everything installed successfully):
$ yarn
yarn install v1.22.5
[1/4] Resolving packages...
success Already up-to-date.
$ is-ci || husky install
husky - Git hooks installed
  • yarn start:services output is:
$ yarn start:services
yarn run v1.22.5
$ docker-compose up
Traceback (most recent call last):
  File "docker\api\client.py", line 214, in _retrieve_server_version
  File "docker\api\daemon.py", line 181, in version
  File "docker\utils\decorators.py", line 46, in inner
  File "docker\api\client.py", line 237, in _get
  File "requests\sessions.py", line 543, in get
  File "requests\sessions.py", line 530, in request
  File "requests\sessions.py", line 643, in send
  File "requests\adapters.py", line 439, in send
  File "urllib3\connectionpool.py", line 670, in urlopen
  File "urllib3\connectionpool.py", line 392, in _make_request
  File "http\client.py", line 1255, in request
  File "http\client.py", line 1301, in _send_request
  File "http\client.py", line 1250, in endheaders
  File "http\client.py", line 1010, in _send_output
  File "http\client.py", line 950, in send
  File "docker\transport\npipeconn.py", line 32, in connect
  File "docker\transport\npipesocket.py", line 23, in wrapped
  File "docker\transport\npipesocket.py", line 72, in connect
  File "docker\transport\npipesocket.py", line 52, in connect
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose\cli\main.py", line 81, in main
  File "compose\cli\main.py", line 200, in perform_command
  File "compose\cli\command.py", line 60, in project_from_options
  File "compose\cli\command.py", line 152, in get_project
  File "compose\cli\docker_client.py", line 41, in get_client
  File "compose\cli\docker_client.py", line 170, in docker_client
  File "docker\api\client.py", line 197, in __init__
  File "docker\api\client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[10388] Failed to execute script docker-compose
error Command failed with exit code 4294967295.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  • yarn start:server output is:

(I needed to trim the error due to comment limit size on GitHub, but I can copy it elsewhere if it is helpful)

$ yarn start:server
yarn run v1.22.5
$ craco start
[HPM] Proxy created: /  -> http://localhost:3274/
(node:29372) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:29372) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
Starting the development server...
Failed to compile.

SyntaxError: D:\Users\APereira\src\OpenWebScrobbler\src\store\actions\userActions.js: Bad character escape sequence. (4:97)
ERROR in ./src/store/actions/userActions.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\Users\APereira\src\OpenWebScrobbler\src\store\actions\userActions.js: Bad character escape sequence. (4:97)
    at instantiate (D:\Users\APereira\src\OpenWebScrobbler\node_modules\@locator\babel-

(...) 

webpack compiled with 11 errors
No issues found.
@elamperti
Copy link
Owner

Hi! Thanks for your interest in the project 😀

I believe the error you get running yarn:services is related to Docker Compose (this repo has no python scripts). This stack overflow thread suggests that it may be because Docker is not running.

I don't get the bad character escape sequence error: it may be related to Windows, which has its own quirks for development (and I'm not familiar enough with it to provide much help!). An alternative that may ease development for you is using WSL (official guide).

Also verify which Node version you're using, if it's too old it may cause problems.
Hope this helps :)

@nighto
Copy link
Author

nighto commented Oct 5, 2023

Hi @elamperti, thanks for your reply.

Yes, indeed having Docker running make the services task run successfully. It might be obvious for those already involved in the project but not for a newbie wanting to contribute, so I will open a PR to include that mention on the Development section of README.md.

Regarding the other one, I will investigate. I tested here and running craco from PowerShell or from git bash didn't make a difference, got the same error. I will set up WSL and test from it as well.

@nighto
Copy link
Author

nighto commented Oct 5, 2023

btw just joined the Discord with the same username Nighto, if you are available to help me getting it running and prefer to support over there. Thanks in advance :)

@nighto
Copy link
Author

nighto commented Oct 5, 2023

image

Indeed running it from WSL made it work fine. :)

So as I mentioned previously I'll create a PR mentioning that, if you running a Windows host, you must run it from WSL.

Btw, I have (almost) the same node on Windows (16.17.1) and on WSL (16.17.0), so that's probably not the issue.

@nighto
Copy link
Author

nighto commented Oct 5, 2023

Hmm I might need some more help with the Last.fm API setup. I have created an API key on last.fm and pasted it to .env.development.local variables LASTFM_API_KEY and LASTFM_SECRET (btw: no quotes are needed, right?)

image

However when I try to login from the localhost application, I get this error. Any idea why?

image

Thanks again.

@elamperti
Copy link
Owner

Hmm I might need some more help with the Last.fm API setup. I have created an API key on last.fm and pasted it to .env.development.local variables LASTFM_API_KEY and LASTFM_SECRET (btw: no quotes are needed, right?)

Quotes in the env file won't hurt (nor change the resulting variable).

However when I try to login from the localhost application, I get this error. Any idea why?

Judging by the screenshot, the API key is not being sourced. Check if your NODE_ENV is properly set to development (from js: process.env.NODE_ENV), if not you may have to force it when starting the application (setting it in the env file won't work).

I'll ping you on Discord to follow up :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment