Error Message
Script Fail.
Symptom
Script execution failed.
Possible Causes
The script file is not found at the target path.
Solution
Ensure that the script file exists at the target path.
Error Message
Invalid Command Error.
Symptom
The command line contains an illegal character.
Possible Causes
The script alias starts with an illegal character, including left parenthesis ((), left bracket ([), and left brace ({). For example, "scripts": { "build": "(echo hello)" } in the oh-package.json5 file.
Solution
Check the script alias and ensure that it does not start with a left parenthesis ((), a left bracket ([), or a left brace ({).
Error Message
Invalid Key.
Symptom
An invalid key error occurs in the script alias.
Possible Causes
The first letter of the script alias is not lowercase, which is regarded as an invalid key.
Solution
Check the first letter of the script alias and ensure that it is lowercase.
Error Message
Invalid KeyLen.
Symptom
The length of the script alias is out of the specified range.
Possible Causes
The length of the script alias is out of the specified range, which is regarded as an invalid key.
Solution
Check the length of the script alias and ensure that it is within the range [1, 128].
Error Message
Invalid ParamLen.
Symptom
The length of the args parameter is out of the specified range.
Possible Causes
The length of the args parameter is out of range. For example, "scripts": { "build": "echo test" } is configured in the oh-package.json5 file, and ohpm run build -- -a ([string]::new("a", 3000)) is executed.
Solution
Check the length of the args parameter and ensure that it is within the range [1, 2048].
Error Message
Invalid Key Regex.
Symptom
The key regular expression is invalid.
Possible Causes
The script alias (script_name) does not meet the required pattern.
Solution
Ensure that the script alias contains only uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).
Error Message
Command Error.
Symptom
The command is incorrect.
Possible Causes
A valid scriptContent cannot reference any ohpm commands except ohpm run (such as ohpm install and ohpm add). For example, "scripts": { "build": "ohpm install pkg" } is configured in the oh-package.json5 file, and ohpm run build is executed.
Solution
Run ohpm commands (such as ohpm install) directly in the terminal. Do not place them in scripts for invocation via the ohpm run command.
Error Message
Parse Pkg Error.
Symptom
Failed to parse the package.
Possible Causes
The oh-package-lock.json5 file format is incorrect.
Solution
Ensure that the oh-package-lock.json5 file meets the format requirements. For details, see oh-package.json5.
Error Message
Prefix Invalid Error.
Symptom
The --prefix option is incorrect.
Possible Causes
The specified path does not contain an oh-package.json5 file. For example, the ohpm run build -- --prefix D:\New directory command is executed, but the oh-package.json5 file cannot be found under D:\New directory.
Solution
Ensure that the specified path contains an oh-package.json5 file.
Error Message
Pkg UnExist Error.
Symptom
The specified package management configuration file is not found.
Possible Causes
The ohpm run build command is executed in the current directory, but the oh-package.json5 file cannot be found under the directory.
Solution
Ensure that the oh-package.json5 file exists in the current directory.
Error Message
Script UnExist Error.
Symptom
The script alias does not exist.
Possible Causes
The script alias is not declared in the oh-package.json5 file.
Solution
Check the oh-package.json5 file and ensure that the script alias is correctly declared and formatted.
Error Message
Script Empty Error.
Symptom
The script to be executed is empty.
Possible Causes
The script to be executed is empty.
Solution
Check the script and ensure that it contains valid commands.
Error Message
Script Invalid Error.
Symptom
The script is invalid.
Possible Causes
The script is invalid. For example, "scripts": { "build": "ohpm" } is configured in the oh-package.json5 file, and ohpm run build is executed.
Solution
Check the script and ensure that it is correctly configured.
Error Message
Script Content Error.
Symptom
The script content is incorrect.
Possible Causes
This error code is returned when all of the following conditions are met:
1. The script contains ohpm run.
2. The script contains the argument separator (--).
3. The script contains the command chaining operator (&& or ||).
For example, "scripts": { "bad": "ohpm run build -- --prefix D:\\test && ohpm run test" } is configured in the oh-package.json5 file, and ohpm run bad is executed.
Solution
Check the script alias configuration to ensure that ohpm run, the argument separator (--), and command chaining operators (&& or ||) are not used simultaneously.
Error Message
Directed Cycle Error.
Symptom
The script contains a circular call, which prevents the script from executing normally.
Possible Causes
The script contains a circular call, for example, "scriptName1": "ohpm run scriptName2","scriptName2": "ohpm run scriptName2".
Solution
Check the script configuration and ensure that there are no circular calls in the script.
Error Message
Invalid Header Param Error.
Symptom
The script parameter is incorrect.
Possible Causes
A script parameter not starting with - or -- is used. Correct example: ohpm run scriptName1 -- arg1=1 --arg2=2.
Solution
Check the script parameters and ensure that they start with - or --, for example, --debug.
Error Message
Invalid Param Error.
Symptom
The parameter is invalid.
Possible Causes
The key and value are not used in pairs during the execution of ohpm run build-- --key value, for example, ohpm run build -- --name value1 value2.
Solution
Check the script parameter format to ensure that parameters start with a single hyphen (-) or double hyphen (--), followed by the parameter name and its value. Supported formats include: --key value (for example, script --name Alice), --key=value (for example, script --age=25), and --key=a=b (for example, script --config=a=b,c=d).
Error Message
Invalid Param Config Error.
Symptom
The parameter passing configuration is invalid.
Possible Causes
The -- prefix is missing before the parameters to be passed. For example, "scripts": { "build": "ohpm run compile -name John" } is configured in the oh-package.json5 file (the -- prefix is missing after compile), and ohpm run build is executed.
Solution
Ensure that the parameters to be passed are prefixed with -- to indicate they should be added or overwritten. For details, see Transferring Parameters.