Skip to content

No default CodiMD server url set #25

@salim-b

Description

@salim-b

I've installed codimd-cli from npm using

npm install --global @hackmd/codimd-cli

and then tried to display the help using

codimd-cli help

which resulted in the following error:

/home/salim/.by_pkg_mngr/npm/lib/node_modules/@hackmd/codimd-cli/lib/config.js:32
    throw new Error(`
    ^

Error: 

Please specify CodiMD server url either in /home/salim/.codimd/config.json or by environment varaible.

You can learn how to config codimd-cli on https://github.com/hackmdio/codimd-cli


    at Object.<anonymous> (/home/salim/.by_pkg_mngr/npm/lib/node_modules/@hackmd/codimd-cli/lib/config.js:32:11)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/home/salim/.by_pkg_mngr/npm/lib/node_modules/@hackmd/codimd-cli/lib/api.js:9:42)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

The README states:

hackmd-cli operates on official HackMD instance (hackmd.io) by default.

But this is obviously not the case for the npm package. Explicitly setting the serverUrl key (to anything) in ~/.codimd/config.json eliminates the error message.

(Besides, there's a typo in the error message above: varaible)


I'm using Node.js 14 on Ubuntu 20.04. npm version gives me

{
  npm: '6.14.5',
  ares: '1.16.0',
  brotli: '1.0.7',
  cldr: '37.0',
  icu: '67.1',
  llhttp: '2.0.4',
  modules: '83',
  napi: '6',
  nghttp2: '1.41.0',
  node: '14.4.0',
  openssl: '1.1.1g',
  tz: '2019c',
  unicode: '13.0',
  uv: '1.37.0',
  v8: '8.1.307.31-node.33',
  zlib: '1.2.11'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions