frappe / bench

CLI to manage Multi-tenant deployments for Frappe apps
https://frappeframework.com/docs/user/en/bench
GNU General Public License v3.0
1.37k stars 1.2k forks source link

TypeError Exist when trying to install ERPNext in FreeBSD 12.4 Jail #1464

Open project2021-code opened 1 year ago

project2021-code commented 1 year ago

Issue: Bug report

Please make sure your issue is reproducible on the latest bench version. The currently supported branches are:

Do the checklist before filing an issue:

Describe the bug :chart_with_downwards_trend: When I try to create a new site, it shows error

To Reproduce :page_with_curl: Steps to reproduce the behavior:

  1. cd frappe-bench
  2. bench new-site site1.local
  3. See error

Expected behavior :chart_with_upwards_trend: site directory is created in sites/site1.local without error

Screenshots :crystal_ball: image image

OS (please complete the following information): :cyclone:

Version Information

Can be found out by running bench version in your respective bench folder.

Additional context :page_facing_up: Add any other context about the problem here.

Possible Solution :bookmark_tabs: Any idea what might be causing the issue. Or if you have a proposed solution to the problem.

ankush commented 1 year ago

Weird. Looks like an issue with Redis value deserializing. Doubt this has anything to do with FreeBSD jails.

project2021-code commented 1 year ago

After some trials, I solved the issue in some instances (some minor error exists).

Built Python3.11.4 and fail2ban from Port.

Use pkg to install node instead of the compile version from nvm.

However, this brings another error.

[frappe@erpnext3 ~]$ cd frappe-bench
[frappe@erpnext3 ~/frappe-bench]$ sudo bench setup production frappe
Setting Up prerequisites...
Setting Up supervisor...
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site site1.local assigned port: 80
Setting Up symlinks and reloading services...
ERROR: expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/commands/setup.py", line 108, in setup_production
    setup_production(user=user, yes=yes)
  File "/usr/local/lib/python3.11/site-packages/bench/config/production_setup.py", line 65, in setup_production
    supervisor_conf = os.path.join(
                      ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/posixpath.py", line 76, in join
    a = os.fspath(a)
        ^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType

Also, the supervisor behaviour is different from the ubuntu one:

[frappe@erpnext3 ~/frappe-bench]$ sudo supervisorctl restart all
Password:
http://localhost:9001 refused connection
project2021-code commented 1 year ago

I try to use a debian LXC to install ERPNext and find the same issue...

frappe@ERPNext:~/frappe-bench$ sudo bench setup production frappe
Setting Up prerequisites...
Setting Up supervisor...
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site site1.local assigned port: 80
Setting Up symlinks and reloading services...
ERROR: expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/commands/setup.py", line 108, in setup_production
    setup_production(user=user, yes=yes)
  File "/usr/local/lib/python3.11/site-packages/bench/config/production_setup.py", line 65, in setup_production
    supervisor_conf = os.path.join(
                      ^^^^^^^^^^^^^
  File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType
vaibhav1770 commented 1 year ago

Im facing the same issue how do you solve this error??

vaibhav1770 commented 1 year ago

Regarding production setup of erpnext

project2021-code commented 1 year ago

It seems that it is a problem in Python. The script cannot find the path. In my case it is nginx path (FreeBSD).

casesolved-co-uk commented 2 months ago

I have a similar error doing bench build on ubuntu:

frappe@frappe:~/v15$ bench build
Assets for Release v15.34.1 don't exist
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/frappe/v15/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/frappe/v15/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/v15/env/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/frappe/v15/apps/frappe/frappe/commands/utils.py", line 77, in build
    bundle(
  File "/home/frappe/v15/apps/frappe/frappe/build.py", line 232, in bundle
    setup()
  File "/home/frappe/v15/apps/frappe/frappe/build.py", line 218, in setup
    app_paths = [os.path.dirname(pymodule.__file__) for pymodule in pymodules]
  File "/home/frappe/v15/apps/frappe/frappe/build.py", line 218, in <listcomp>
    app_paths = [os.path.dirname(pymodule.__file__) for pymodule in pymodules]
  File "/usr/lib/python3.10/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType