vuejs/vue-cli · error · Error
Couldn't parse inline options JSON: ${e.message}
Error message
Couldn't parse inline options JSON: ${e.message} What it means
Thrown during `vue invoke` when the user passes inline options via the `--inlineOptions` (aliased as $inlineOptions) flag and the provided value is not valid JSON. The invoke command attempts JSON.parse on the string; on failure it wraps the parse error message and re-throws.
Source
Thrown at packages/@vue/cli/lib/invoke.js:66
`Cannot resolve plugin ${chalk.yellow(pluginName)} from package.json. ` +
`Did you forget to install it?`
)
}
const pluginGenerator = loadModule(`${id}/generator`, context)
if (!pluginGenerator) {
throw new Error(`Plugin ${id} does not have a generator.`)
}
// resolve options if no command line options (other than --registry) are passed,
// and the plugin contains a prompt module.
// eslint-disable-next-line prefer-const
let { registry, $inlineOptions, ...pluginOptions } = options
if ($inlineOptions) {
try {
pluginOptions = JSON.parse($inlineOptions)
} catch (e) {
throw new Error(`Couldn't parse inline options JSON: ${e.message}`)
}
} else if (!Object.keys(pluginOptions).length) {
let pluginPrompts = loadModule(`${id}/prompts`, context)
if (pluginPrompts) {
const prompt = inquirer.createPromptModule()
if (typeof pluginPrompts === 'function') {
pluginPrompts = pluginPrompts(pkg, prompt)
}
if (typeof pluginPrompts.getPrompts === 'function') {
pluginPrompts = pluginPrompts.getPrompts(pkg, prompt)
}
pluginOptions = await prompt(pluginPrompts)
}
}
const plugin = {
id,View on GitHub (pinned to 7eb93c169c)
Solutions
- Use strict JSON syntax: double-quoted keys, double-quoted string values, no trailing commas.
- Validate the JSON with a linter or `echo '<json>' | jq .` before running the command.
- If options are complex, consider putting them in a file or using the interactive prompt instead.
Example fix
# before
$ vue invoke eslint --inlineOptions "{lintOn: 'save'}"
Error: Couldn't parse inline options JSON
# after
$ vue invoke eslint --inlineOptions '{"lintOn": "save"}' Defensive patterns
Strategy: validation
Validate before calling
function tryParseInlineOptions(str) {
try {
JSON.parse(str);
return true;
} catch (e) {
return false;
}
}
// before running the command:
if ($inlineOptions && !tryParseInlineOptions($inlineOptions)) {
console.error('Inline options must be valid JSON. Use double quotes for keys and values.');
} Try / catch
try {
pluginOptions = JSON.parse($inlineOptions);
} catch (e) {
// provide a more helpful message with the exact parse location
throw new Error(`Invalid inline options JSON: ${e.message}. Ensure double-quoted keys/values and no trailing commas.`);
} Prevention
- Use strict JSON: double-quoted keys, double-quoted strings, no trailing commas, no comments.
- Validate inline JSON with `echo '<json>' | jq .` or node -e before running.
- Prefer interactive prompts or config files for complex options.
When it happens
Trigger: Running `vue invoke <plugin> --inlineOptions '{useConfigFiles: true}'` where the JSON has unquoted keys, trailing commas, single quotes, or other syntax errors. JavaScript object literals are not valid JSON.
Common situations: Developer writes a JS object literal instead of strict JSON (single quotes, unquoted keys, trailing commas). Copy-pasting from documentation that uses JS shorthand notation.
Related errors
- Make sure you define a value for the option ${options.set}
- Cannot resolve plugin ${pluginName} from package.json. Did y
- The package.json is malformed
- Expected string or integer value.
- Plugin ${id} does not have a generator.
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/c8cb699349224619.
Report an issue: GitHub.