Skip to content

Instantly share code, notes, and snippets.

@visamz
Last active March 18, 2018 12:45
Show Gist options
  • Save visamz/21abbb23812919792fae to your computer and use it in GitHub Desktop.
Save visamz/21abbb23812919792fae to your computer and use it in GitHub Desktop.
npm_prompt.lua:11: attempt to concatenate local 'package_version' (a nil value)
c:\cmder/vendor/clink-completions/npm_prompt.lua:11: attempt to concatenate local 'package_version' (a nil value)
The solution that worked for me was to edit the file:
{YOUR_PATH}/cmder/vendor/clink-completions/npm_prompt.lua
and overwrite the related lines to be this instead:
The original npm_prompt.lua was (BEFORE FIX)
...
local package_name = string.match(package_info, '"name"%s*:%s*"(%g-)"')
local package_version = string.match(package_info, '"version"%s*:%s*"(.-)"')
...
and the change is (AFTER FIX):
...
local package_name = string.match(package_info, '"name"%s*:%s*"(%g-)"')
if package_name == nil then
package_name = ''
end
local package_version = string.match(package_info, '"version"%s*:%s*"(.-)"')
if package_version == nil then
package_version = ''
end
...
```
@ScottShingler
Copy link

ScottShingler commented Jul 19, 2017

An alternative that will completely hide the yellow (@) if both package_name and package_version are nil:

...
local package_name = string.match(package_info, '"name"%s*:%s*"(%g-)"') -- Unchanged
local package_version = string.match(package_info, '"version"%s*:%s*"(.-)"') -- Unchanged
if package_name == nil and package_version == nil then
    return false
end
if package_name == nil then
    package_name = ''
end
if package_version == nil then
    package_version = ''
end
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment