Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module '../lib' when running CLI after global install #490

Closed
vergenzt opened this issue Jun 25, 2020 · 1 comment
Closed

Comments

@vergenzt
Copy link

vergenzt commented Jun 25, 2020

Hi! I'm trying to use this tool in a shell script to parse an incoming HTTP request.

To repro

  1. npm install -g gavel
  2. gavel

Expected

A help text or something.

Actual

$ npm install -g --verbose gavel
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   '/Users/tim/.nvm/versions/node/v12.18.1/bin/node',
npm verb cli   '/Users/tim/.nvm/versions/node/v12.18.1/bin/npm',
npm verb cli   'install',
npm verb cli   '-g',
npm verb cli   '--verbose',
npm verb cli   'gavel'
npm verb cli ]
npm info using npm@6.14.5
npm info using node@v12.18.1
npm verb npm-session 8d81ca19356ee707
npm http fetch GET 304 https://registry.npmjs.org/gavel 223ms (from cache)
npm timing stage:loadCurrentTree Completed in 270ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms
npm http fetch GET 304 https://registry.npmjs.org/ajv 77ms (from cache)
...
npm http fetch GET 304 https://registry.npmjs.org/querystring 49ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 1125ms
npm timing stage:loadIdealTree Completed in 1160ms
npm timing stage:generateActionsToTake Completed in 15ms
npm verb correctMkdir /Users/tim/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /Users/tim/.npm/_locks/staging-167cf218bfbf166b.lock for /Users/tim/.nvm/versions/node/v12.18.1/lib/node_modules/.staging
npm timing action:extract Completed in 923ms
npm timing action:finalize Completed in 111ms
npm timing action:refresh-package-json Completed in 142ms
npm info lifecycle api-blueprint-http-formatter@0.0.1~preinstall: api-blueprint-http-formatter@0.0.1
...
npm info lifecycle gavel@9.1.3~postinstall: gavel@9.1.3
npm timing action:postinstall Completed in 33ms
npm verb unlock done using /Users/tim/.npm/_locks/staging-167cf218bfbf166b.lock for /Users/tim/.nvm/versions/node/v12.18.1/lib/node_modules/.staging
npm timing stage:executeActions Completed in 1311ms
npm timing stage:rollbackFailedOptional Completed in 0ms
npm timing stage:runTopLevelLifecycles Completed in 2764ms
+ gavel@9.1.3
added 41 packages from 47 contributors in 2.766s
npm verb exit [ 0, true ]
npm timing npm Completed in 3317ms
npm info ok
$ gavel
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '../lib'
Require stack:
- /Users/tim/.nvm/versions/node/v12.18.1/lib/node_modules/gavel/bin/gavel
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/tim/.nvm/versions/node/v12.18.1/lib/node_modules/gavel/bin/gavel:7:13)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/tim/.nvm/versions/node/v12.18.1/lib/node_modules/gavel/bin/gavel'
  ]
}

What else I tried

  • Installing locally and invoking ./node_modules/bin/gavel
  • Switching to an earlier node version

Both failed.

Environment

  • node v12.18.1, installed via nvm 0.33.8
@kylef kylef added the bug label Jun 25, 2020
@kylef kylef closed this as completed in 8d205b3 Aug 13, 2020
@ApiaryBot
Copy link
Collaborator

🎉 This issue has been resolved in version 9.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants