-
Notifications
You must be signed in to change notification settings - Fork 57
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 when using with python in a directory that is declared to be a js-module #149
Comments
Can you please elaborate more on how you got this error (and your proposed fix?) |
Thx for replying and taking care. Sorry for the initial incomplete description. I now added a reproduction repo and slightly improved solution suggestions. |
Can't reproduce on a new github codespace: ➜ /workspaces/python-js-module-bug (main) $ poetry install
Creating virtualenv python-js-module-WaJCDlOP-py3.12 in /home/codespace/.cache/pypoetry/virtualenvs
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing javascript (1!1.2.1)
➜ /workspaces/python-js-module-bug (main) $ poetry run python python-that-imports-js.py
[
'.git',
'.gitignore',
'README.md',
'module-based-js-file.js',
'package-lock.json',
'package.json',
'poetry.lock',
'pyproject.toml',
'python-that-imports-js.py'
]
➜ /workspaces/python-js-module-bug (main) $ node --version
v20.17.0
➜ /workspaces/python-js-module-bug (main) $ python --version
Python 3.12.1 |
This works as your So the projects package.json is not interfering with the .venv js files. |
Reproduction Repo: https://github.com/spike-rabbit/python-js-module-bug
The important part is, that the venv are in the same directory or below the projects
package.json
.Error:
Potential solutions
Sure, I could move things around in my project to get rid of the module problem.
But the much nicer solutions would be either:
.js
files provided by thejavascript
module all have.cjs
ending to ensure they are always treated as commonjspackage.json
inside thejavascript
module that explicitly declare{"type": "commonjs"}
The text was updated successfully, but these errors were encountered: