npm run build-translation error
Opened this issue · 7 comments
Bug description
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.10
Node version
18 or greater
Browser
Chrome
Additional context
No response
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
I found a couple of similar discussions that might be relevant to your issue:
-
Error while building the superset non-dev - This discussion is still open and might contain insights related to build issues in the Superset project [1].
-
Problem compiling translations - This is another open discussion that deals with issues related to compiling translations, which might be similar to the problem you're encountering [2].
Regarding your specific issue with the npm run build-translation
command not being recognized, ensure that you have installed all necessary dependencies by running npm ci
in the superset-frontend
directory. This step is crucial as it installs the required Node.js packages that might include the po2json
tool used in the build-translation
script [3].
Additionally, verify that your environment is set up correctly with Node.js version 18 or greater, as specified in the prerequisites for running the build-translation
script [4]. If the command is still not recognized, it might be helpful to check if the scripts/po2json.sh
file is executable and that the po2json
command is available in your PATH.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
@dosu I use windows, it still error
Running shell scripts like po2json.sh
on Windows can sometimes lead to issues because Windows doesn't natively support Unix shell scripts. Here are a few options you can try:
-
Use Windows Subsystem for Linux (WSL): Install WSL and run your commands in a Linux environment on Windows. This can help you execute shell scripts as if you were on a Unix-based system.
-
Use Git Bash: Git for Windows comes with Git Bash, which provides a Unix-like shell. You can try running your script using Git Bash.
-
Docker Setup: Consider using Docker to run Superset. This approach can bypass Windows-specific issues by running everything in a containerized environment. You can follow the Docker setup instructions provided in the Superset documentation to get started [1][2].
These methods should help you run the build-translation
script on a Windows machine.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
@dosu MAIMAI@DESKTOP-6ORQ37F MINGW64 /f/LT/workspcae_new/superset-master/superset-frontend
$ npm run build-translation
superset@0.0.0-dev build-translation
scripts/po2json.sh
'scripts' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
bash still error
To resolve the error "'scripts' is not recognized as an internal or external command" when running npm run build-translation
on Windows using MINGW64, you can try the following:
-
Use Git Bash: Ensure you are using Git Bash to run the command, as it provides a Unix-like environment on Windows. Open Git Bash, navigate to your project directory, and run
npm run build-translation
. -
Windows Subsystem for Linux (WSL): If Git Bash doesn't work, consider using WSL. Install WSL and run your commands in a Linux environment on Windows. This can help you execute shell scripts as if you were on a Unix-based system.
-
Convert to Batch Script: Alternatively, you can convert the
po2json.sh
shell script to a Windows batch script. This involves translating the shell commands to their Windows equivalents and updating thebuild-translation
script inpackage.json
to point to this new batch file. This requires some knowledge of the commands used inpo2json.sh
and their Windows counterparts [1].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
@dosu exe_main_.py", line 7, in
sys.exit(main())
~~~~^^
File "C:\Users\MAIMAI\AppData\Local\Programs\Python\Python313\Lib\site-package
s\po2json_init_.py", line 62, in main
for lang_code in os.listdir(locale_path):
The error you're encountering suggests that the locale_path
directory is either missing or inaccessible, which is causing the os.listdir()
function to fail. Here are a few steps you can take to troubleshoot and resolve this issue:
-
Verify
locale_path
: Ensure that thelocale_path
variable in your script is correctly set to the directory containing your.po
files. This directory should exist and be accessible. -
Check Directory Permissions: Make sure that the directory specified by
locale_path
has the appropriate permissions set, allowing the script to read its contents. -
Path Format: On Windows, ensure that the path is correctly formatted. You might need to use raw strings (e.g.,
r"C:\path\to\directory"
) or double backslashes (e.g.,"C:\\path\\to\\directory"
) to avoid issues with escape characters. -
Debugging: Add a print statement before the
os.listdir()
call to output the value oflocale_path
. This can help confirm that the path is what you expect.
If these steps don't resolve the issue, consider checking if there are any platform-specific considerations for running Python scripts that interact with the filesystem on Windows, as these might affect how paths are handled.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other