mdsb100 / cli-gitlab

GitLab CLI library
101 stars 11 forks source link

TypeError: require(...) is not a function #16

Open stalinkay opened 6 years ago

stalinkay commented 6 years ago

@mdsb100 Hi. I'm getting the following error when I run gitlab projects. I'm running node v9.11.1. I had it working before so it may be due to the node version. See command output below.

/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:56
      gitlab = require("gitlab")({
                                ^

TypeError: require(...) is not a function
    at requireOrGetGitlab (/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:56:33)
    at Command.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:242:16)
    at Command.listener (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:180:13)
    at Command.parseArgs (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:651:12)
    at Command.parse (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:474:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/command.js:19:9)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/gitlab:2:1)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
mdsb100 commented 6 years ago

I will check it.

The temporary solution is:

install nvm

stalinkay commented 6 years ago

@mdsb100 Cool. Will do that. Thanks.

mdsb100 commented 6 years ago

@stalinkay Fixed and Published

1524064180661

stalinkay commented 6 years ago

@mdsb100 Thanks for the update.

stalinkay commented 6 years ago

@mdsb100 I'm still experiencing the same issue. Although it's on a different line now. My configuration is correct as well.

/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:58
      gitlab = gitlabLib({
               ^

TypeError: gitlabLib is not a function
    at requireOrGetGitlab (/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:58:16)
    at Command.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/worker.js:244:16)
    at Command.listener (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:180:13)
    at Command.parseArgs (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:651:12)
    at Command.parse (/usr/local/lib/node_modules/cli-gitlab/node_modules/commander/index.js:474:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/command.js:19:9)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/cli-gitlab/bin/gitlab:2:1)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
mdsb100 commented 6 years ago

I will refactor

mdsb100 commented 6 years ago

Please take a look https://github.com/mdsb100/node-gitlab#cli I create a pull-request to node-gitlab. If node-gitlab does not accept it, I will publish myself by using name cli-gitlab.

mdsb100 commented 6 years ago

For now, you can use it locally by npm link

git clone
cd node-gitlab && npm install
npm run build
npm link