{"action":"created","issue":{"url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/925","repository_url":"https://api.github.com/repos/cnpm/cnpmjs.org","labels_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/925/labels{/name}","comments_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/925/comments","events_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/925/events","html_url":"https://github.com/cnpm/cnpmjs.org/issues/925","id":155957630,"number":925,"title":"[Error: TypeError config.userService.auth(...)]  npm adduser 失败 & 如何加入权限验证 ","user":{"login":"ucoker","id":12216739,"avatar_url":"https://avatars.githubusercontent.com/u/12216739?v=3","gravatar_id":"","url":"https://api.github.com/users/ucoker","html_url":"https://github.com/ucoker","followers_url":"https://api.github.com/users/ucoker/followers","following_url":"https://api.github.com/users/ucoker/following{/other_user}","gists_url":"https://api.github.com/users/ucoker/gists{/gist_id}","starred_url":"https://api.github.com/users/ucoker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucoker/subscriptions","organizations_url":"https://api.github.com/users/ucoker/orgs","repos_url":"https://api.github.com/users/ucoker/repos","events_url":"https://api.github.com/users/ucoker/events{/privacy}","received_events_url":"https://api.github.com/users/ucoker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-20T12:59:41Z","updated_at":"2016-05-20T15:57:53Z","closed_at":null,"body":"- **环境**\r\n  - ubuntu 14.04\r\n  - node v5.11.1\r\n  - npm 3.9.2\r\n  - cnpm 从Github获取，按wiki教程安装\r\n\r\n\r\n- **`npm adduser ...`失败**  \r\n根据wiki的这篇文章搭建了cnpm －－》 [Deploy From Source Code [recommend]](https://github.com/cnpm/cnpmjs.org/wiki/Deploy#deploy-from-source-code-recommend)  \r\n可以正常打开 http://localhost:7002\r\n![qq20160520-0](https://cloud.githubusercontent.com/assets/12216739/15427917/ea7d1f3e-1eca-11e6-8a57-529020362988.png)  \r\n在终端上执行：  \r\n`npm adduser --registry=http://127.0.0.1:7001 --verbose`后，没能成功添加。错误代码：\r\n\r\n\t```bash\r\n\tnpm verb adduser before first PUT { _id: 'org.couchdb.user:username',\r\n\tnpm verb adduser   name: 'username',\r\n\tnpm verb adduser   password: 'XXXXX',\r\n\tnpm verb adduser   email: 'username@username.com',\r\n\tnpm verb adduser   type: 'user',\r\n\tnpm verb adduser   roles: [],\r\n\tnpm verb adduser   date: '2016-05-20T09:46:35.917Z' }\r\n\tnpm verb request uri http://localhost:7001/-/user/org.couchdb.user:username\r\n\tnpm verb request new user, so can't send auth\r\n\tnpm info attempt registry request try #1 at 5:46:35 PM\r\n\tnpm verb request id 585ce5a9b9c40f9c\r\n\tnpm http request PUT http://localhost:7001/-/user/org.couchdb.user:username\r\n\tnpm http 500 http://localhost:7001/-/user/org.couchdb.user:username\r\n\tnpm verb headers { 'content-type': 'application/json; charset=utf-8',\r\n\tnpm verb headers   'x-readtime': '9',\r\n\tnpm verb headers   'content-length': '101',\r\n\tnpm verb headers   date: 'Fri, 20 May 2016 09:46:35 GMT',\r\n\tnpm verb headers   connection: 'keep-alive' }\r\n\tnpm info retry will retry, error on last attempt: Error: TypeError config.userService.auth(...)[(intermediate value)] is not a function: -/user/org.couchdb.user:username\r\n\tnpm info attempt registry request try #2 at 5:46:46 PM\r\n\tnpm http request PUT http://localhost:7001/-/user/org.couchdb.user:username\r\n\tnpm http 500 http://localhost:7001/-/user/org.couchdb.user:username\r\n\tnpm verb headers { 'content-type': 'application/json; charset=utf-8',\r\n\tnpm verb headers   'x-readtime': '2',\r\n\tnpm verb headers   'content-length': '101',\r\n\tnpm verb headers   date: 'Fri, 20 May 2016 09:46:46 GMT',\r\n\tnpm verb headers   connection: 'keep-alive' }\r\n\tnpm info retry will retry, error on last attempt: Error: TypeError config.userService.auth(...)[(intermediate value)] is not a function: -/user/org.couchdb.user:username\r\n\t```\r\n\r\n\t**在issue或者Google上都未能找到与`Error: TypeError config.userService.auth(...)[(intermediate value)]`相关的错误解决办法，请问我应该如何解决？**\r\n\r\n- **如何加入权限验证**  \r\n\r\n\t我想使用cnpm作为私有库，但是并非搭建在内网。而是在阿里云的ubuntu平台上搭建。\r\n\t若要加权限验证，是否是根据这篇－－》[Use-Your-Own-User-Authorization](https://github.com/cnpm/cnpmjs.org/wiki/Use-Your-Own-User-Authorization)来配置？\r\n\t例如这样配置：\r\n\t修改`cnpmjs.org/config/index.js`:\r\n\t\r\n\t```json\r\n\t...\r\n\tadmins: {\r\n\t    // name: email\r\n\t    username: 'username@username.com'\r\n\t  },\r\n\tuserService: {\r\n\t    \"login\": \"username\",\r\n\t    \"email\": \"username@username.com\",\r\n\t    \"scopes\": [ \"@db\" ]\r\n\t  },\r\n\t alwaysAuth: true,\r\n\t```\r\n\t\r\n\t修改完这个配置，重新启动服务后。对应的账号密码是不是又 `npm adduser ...`来产生？\r\n\r\n### 总结下遇到的两个问题：\r\n- `npm adduser ...`失败，具体错误信息在上面。\r\n- 将cnpm搭建在公网阿里云，如何正确添加权限验证。"},"comment":{"url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/comments/220645872","html_url":"https://github.com/cnpm/cnpmjs.org/issues/925#issuecomment-220645872","issue_url":"https://api.github.com/repos/cnpm/cnpmjs.org/issues/925","id":220645872,"user":{"login":"ucoker","id":12216739,"avatar_url":"https://avatars.githubusercontent.com/u/12216739?v=3","gravatar_id":"","url":"https://api.github.com/users/ucoker","html_url":"https://github.com/ucoker","followers_url":"https://api.github.com/users/ucoker/followers","following_url":"https://api.github.com/users/ucoker/following{/other_user}","gists_url":"https://api.github.com/users/ucoker/gists{/gist_id}","starred_url":"https://api.github.com/users/ucoker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucoker/subscriptions","organizations_url":"https://api.github.com/users/ucoker/orgs","repos_url":"https://api.github.com/users/ucoker/repos","events_url":"https://api.github.com/users/ucoker/events{/privacy}","received_events_url":"https://api.github.com/users/ucoker/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T15:57:53Z","updated_at":"2016-05-20T15:57:53Z","body":"现在是 `npm adduser ...` 后失败，提示  `Error: TypeError config.userService.auth(...)[(intermediate value)] `  \r\n奇怪我并在网上没找到跟我类似的情况，不清楚我是哪里错了，或者环境哪边没弄好。 \r\n环境的搭建我参考这篇  https://github.com/cnpm/cnpmjs.org/wiki/Deploy#deploy-from-source-code-recommend\r\n"}}
{"actor":{"display_login":"ucoker"}}