docsifyjs/docsify-cli

--local 参数,运行失败。提示错误

qiuqiuwang99 opened this issue · 4 comments

Bug Report

Steps to reproduce

[root@localhost /]# docsify init ~/doc1 --local
/usr/local/lib/node_modules/docsify-cli/node_modules/yargs/yargs.js:1184
else throw err
^

TypeError: Assignment to constant variable.
at Object.module.exports [as init] (/usr/local/lib/node_modules/docsify-cli/lib/commands/init.js:34:10)
at Object.handler (/usr/local/lib/node_modules/docsify-cli/bin/docsify:49:26)
at Object.runCommand (/usr/local/lib/node_modules/docsify-cli/node_modules/yargs/lib/command.js:240:40)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/docsify-cli/node_modules/yargs/yargs.js:1096:41)
at Object.get [as argv] (/usr/local/lib/node_modules/docsify-cli/node_modules/yargs/yargs.js:1024:21)
at Object. (/usr/local/lib/node_modules/docsify-cli/bin/docsify:129:41)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
[root@localhost /]#

What is current behaviour

What is the expected behaviour

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: CentOS 7

  • Node.js version: 13.7.0

  • npm/yarn version: Docsify 自带yarn

  • Browser version:

  • Docsify version: 4.4.0

  • Docsify plugins:

cc @jamesgeorge007 Please take a look

I changed that

...
const main = pwd("template/index.html");

  if (local) {
    main = pwd("template/index.local.html");
...

to that

...
let main = pwd("template/index.html");

  if (local) {
    main = pwd("template/index.local.html");
...

in /usr/local/lib/node_modules/docsify-cli/lib/commands/init.js.

Thanks @cakebake. Maybe you should do a PR?