apiaryio / gavel.js

Validator of HTTP messages (JavaScript implementation)
MIT License
97 stars 22 forks source link

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

Closed vergenzt closed 4 years ago

vergenzt commented 4 years ago

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

Both failed.

Environment

ApiaryBot commented 4 years ago

:tada: This issue has been resolved in version 9.1.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: