cli-gitlab icon indicating copy to clipboard operation
cli-gitlab copied to clipboard

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

Open stalinkay opened this issue 7 years ago • 8 comments

@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)

stalinkay avatar Apr 18 '18 06:04 stalinkay

I will check it.

The temporary solution is:

install nvm

mdsb100 avatar Apr 18 '18 07:04 mdsb100

@mdsb100 Cool. Will do that. Thanks.

stalinkay avatar Apr 18 '18 07:04 stalinkay

@stalinkay Fixed and Published

1524064180661

mdsb100 avatar Apr 18 '18 15:04 mdsb100

@mdsb100 Thanks for the update.

stalinkay avatar Apr 18 '18 16:04 stalinkay

@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)

stalinkay avatar Apr 18 '18 16:04 stalinkay

I will refactor

mdsb100 avatar Aug 13 '18 02:08 mdsb100

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 avatar Aug 14 '18 11:08 mdsb100

For now, you can use it locally by npm link

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

mdsb100 avatar Aug 15 '18 03:08 mdsb100