oclif: Cannot find module globby when running CLI

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Whenever I run a command on CLI built using oclif, I get the following error:

(node:8716) [MODULE_NOT_FOUND] Error Plugin: mycli: Cannot find module 'globby'
module: @oclif/config@1.6.33
task: not loading commands, globby not found
plugin: mycli
root: /Users/sumbhavsethia/.nvm/versions/node/v8.11.1/lib/node_modules/mycli
See more details with DEBUG=*

Installing globby globally resolves the issue

What is the expected behavior?

I should not have to install globby globally to be able to run the CLI. It should be installed as a dependency of oclif

More information

Node version: 8.11.1 oclif version: 1.4.33

package.json:

"dependencies": {
    "@oclif/command": "^1.4.33",
    "@oclif/config": "^1.6.33",
    "@oclif/plugin-help": "^1.2.11",
    "bluebird": "^3.5.1",
    "bluebird-retry": "^0.11.0",
    "chalk": "^2.3.2",
    "command-exists": "^1.2.2",
    "execa": "^0.10.0",
    "hostile": "^1.3.1",
    "inquirer": "^5.2.0",
    "inquirer-path": "^1.0.0-beta5",
    "joi": "^13.1.2",
    "latest-version": "^3.1.0",
    "lodash": "^4.17.5",
    "ora": "^2.0.0",
    "pg": "^7.4.1",
    "portscanner": "^2.1.1",
    "request": "^2.85.0",
    "request-promise": "^4.2.2",
    "semver": "^5.5.0",
    "ssh-config": "^1.1.3",
    "sshpk": "^1.14.1",
    "sudo-prompt": "^8.2.0",
    "table": "^4.0.3",
    "tmp-promise": "^1.0.4",
    "wait-port": "^0.2.2"
},
"oclif": {
    "commands": "./src/commands",
    "bin": "mybin",
    "plugins": [
      "@oclif/plugin-help"
    ],
    "topics": {
      "atopic": {
        "description": "Manages atopic"
      }
    }
},

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 25 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I’m confused as to what the solution is here, and (at least in my experience), this has made for a pretty frustrating onboarding experience. If I follow the readme and install oclif, then generate a new cli, then try to run --version, I get this error.

I have no oclif manifest in the generated project directory, and there are 0 instances of “manifest” in the readme. Globally installing globby doesn’t help, and adding it to the generated project simply gives a new error:

(node:60043) [MODULE_NOT_FOUND] Error Plugin: mux-cli: Cannot find module '/Users/mmcc/Projects/oclif-test/cli/src/commands/hello'
module: @oclif/config@1.10.4
task: toCached
plugin: oclif-test
root: /Users/mmcc/Projects/oclif-test/cli
See more details with DEBUG=*
oclif-test/0.0.0 darwin-x64 node-v9.11.1

If I try to run yarn prepack as some of the linked issues seem to imply, I get a different, equally concerning TypeScript error:

$> yarn prepack
yarn run v1.12.3
$ rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme                                           
error TS5023: Unknown compiler option 'b'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 

I could absolutely just be missing something dumb, but I’ve run through the readme examples a few times and always end up here.

Edit: I’d been trying to generate a multi cli, but I tried single just to see. For what it’s worth, single does not appear to have this issue for me.

Edit #2: Took a shot in the dark and switched to 10 and…everything seems to be working. I’m just going to slowly back away and assume everything’s fine now.

I did npm install --save-dev globby and now it works.

To fix the error I had to delete .node_modules and run yarn install again. Im using the sfdx plugins which uses Ocliff.

I did npm install --save-dev globby and now it works.

I ran through the steps here and did got the globby missing dependency mesage

https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_generate_prepare.htm

image

I tried to install it globally and did not work. The message is still being displayed. Could anybody help me with it?