无法使用 apiDocjs 生成文档

Unable to generate the documentation using apiDocjs

浏览了几个教程和文档, 包括主要文档 here。随后,创建了两个文件:

1) example.js

var currentUser={
name='Mary'
};
/**
* @api {get} /user/ Request User information
* @apiName GetUser
* @apiGroup User
*/

function getUser(){
 return {code 200,data:currentUser};
}
function setName(name){
    if(name.length==0){
      return {code:404,message:'NameEmptyError'};
    }
currentUser.name=name;
return {code 204};
}

2) testpython.py

"""
@api {get} /user/ Request User information
@apiName GetUser
@apiGroup User
"""
print "hello"

将它们都保存在一个文件夹中,比方说 "my_project"。 在 mac 终端上,转到 "my_project" 的父目录。 运行 脚本:

apidoc -i my_project/ -o apidoc/

获取错误:

 - ERROR - Failed to parse sources

这是基本的,但不知何故,没有成功。

当您同时从 npm 和 pip3 安装包时会发生这种情况。完全清除当前安装的 apiDoc 包。 要删除 npm 包,请转到终端并输入:

cd /usr/local/lib/node_modules

然后要卸载它,请键入:

sudo npm uninstall apidoc

这将删除 npm-apidoc 包。 删除 pip3 包:

sudo pip3 uninstall apidoc 

要手动删除它们,请继续:

/usr/local/lib/pythonVERSION/dist-packages

现在进行全新安装:

sudo npm install apidoc -g

应该这样做 :)。