tmcw / docbox

REST API documentation generator
ISC License
1.14k stars 190 forks source link

issue with build #20

Closed shayneo closed 7 years ago

shayneo commented 7 years ago
src/render.js -> lib/render.js
/path/to/docbox/lib/custom/index.js:39
  return str.replace(/{[\w_]+}/g, function (str) {
            ^

TypeError: Cannot read property 'replace' of undefined
    at highlightTokens (/path/to/docbox/lib/custom/index.js:39:13)
    at module.exports.transformURL (/path/to/docbox/lib/custom/index.js:57:224)
    at /path/to/docbox/lib/components/content.js:69:47
    at Array.forEach (native)
    at /path/to/docbox/lib/components/content.js:58:11
    at Array.map (native)
    at chunkifyAST (/path/to/docbox/lib/components/content.js:48:6)
    at render (/path/to/docbox/lib/components/content.js:115:7)
    at /path/to/docbox/node_modules/react-dom/lib/ReactCompositeComponent.js:796:21
    at measureLifeCyclePerf (/path/to/docbox/node_modules/react-dom/lib/ReactCompositeComponent.js:75:12)

npm ERR!     babel src --out-dir lib && node lib/render.js "index.html"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs docbox
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls docbox
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /path/to/docbox/npm-debug.log

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.9.2
npm ERR! npm  v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! docbox@1.0.2 build: `NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the docbox@1.0.2 build script 'NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the docbox package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs docbox
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls docbox
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /path/to/docbox/npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@4.1.1
3 info using node@v6.9.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle docbox@1.0.2~prebuild: docbox@1.0.2
6 silly lifecycle docbox@1.0.2~prebuild: no script for prebuild, continuing
7 info lifecycle docbox@1.0.2~build: docbox@1.0.2
8 verbose lifecycle docbox@1.0.2~build: unsafe-perm in lifecycle true
9 verbose lifecycle docbox@1.0.2~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/path/to/docbox/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle docbox@1.0.2~build: CWD: /path/to/docbox
11 silly lifecycle docbox@1.0.2~build: Args: [ '-c',
11 silly lifecycle   'NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html' ]
12 silly lifecycle docbox@1.0.2~build: Returned: code: 1  signal: null
13 info lifecycle docbox@1.0.2~build: Failed to exec build script
14 verbose stack Error: docbox@1.0.2 build: `NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid docbox@1.0.2
16 verbose cwd /path/to/docbox
17 error Darwin 16.4.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
19 error node v6.9.2
20 error npm  v4.1.1
21 error code ELIFECYCLE
22 error docbox@1.0.2 build: `NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html`
22 error Exit status 1
23 error Failed at the docbox@1.0.2 build script 'NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the docbox package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     NODE_ENV=production browserify src/index.js | uglifyjs -c -m > bundle.js && npm run prerender -- index.html
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs docbox
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls docbox
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Pretty sure it started when I added in this markdown file

## Diagnostic Service Overview
In addition to transmitting real-time vehicle telemetry information, the Vinli Device interrogates the vehicle for the status of the malfunction indicator lamp (MIL) or “Check Engine Light”. If the device detects that the MIL is illuminated, it requests the active diagnostic trouble codes (DTCs) for the vehicle. All of this information is sent to the Vinli Platform and can be accessed via the Diagnostic Service API.

## Get DTCs for a Vehicle
This provides historical record of DTC codes for a given vehicle. Each time a new DTC code is seen, it triggers a DTC Event. These events either resolve when the DTC code is no longer seen or remain “open” until the code is resolved.

The state query param may be used to filter the response. Valid values are active and inactive. These will filter the response to only include either DTC codes that are still on presently or not. The absence of the state query param will not filter the response and so the response will contain the full history DTC codes.

```endpoint
GET https://diagnostic.vin.li/api/v1/vehicles/47fa348e-c3fa-4cad-8272-61940eae7748/codes

Get a DTC

DTC Lookup

tmcw commented 7 years ago

Thanks for the testcase. Can you tinker with removing that file or others and seeing when the problem starts? I've tested docbox with that input, on Node v4, 6, and 7, and wasn't able to isolate the problem. Most likely, the issue is an endpoint without a HTTP verb, like

```endpoint
https://diagnostic.vin.li/api/v1/vehicles/47fa348e-c3fa-4cad-8272-61940eae7748/codes
```

If you run npm test, the tests should be able to detect an endpoint formatted that way.

shayneo commented 7 years ago

Thanks @tmcw that fixed it. I'll be sure to use npm test next time 😉