Skip to content

Tooling doesn't work on Windows #169

@johnathanDOS

Description

@johnathanDOS

Doing npm start on a Windows machine returns an error like this:

> node ./scripts/server.js

[metalsmith-watch] ✓ Live reload server started on port: 35729
TypeError: Cannot read property 'split' of undefined
    at createInPageIndexes (C:\Path\Documentation\node_modules\metalsmith-lunr\lib\index.js:66:49)
    at indexDocs (C:\Path\Documentation\node_modules\metalsmith-lunr\lib\index.js:43:27)
    at Ware.<anonymous> (C:\Path\Documentation\node_modules\metalsmith-lunr\lib\index.js:11:5)
    at Ware.<anonymous> (C:\Path\Documentation\node_modules\metalsmith\node_modules\wrap-fn\index.js:45:19)
    at next (C:\Path\Documentation\node_modules\metalsmith\node_modules\ware\lib\index.js:85:20)
    at C:\Path\Documentation\node_modules\metalsmith\node_modules\wrap-fn\index.js:121:18
    at C:\Path\mistydoc\Documentation\node_modules\metalsmith-autotoc\index.js:142:7
    at done (C:Path\Documentation\node_modules\metalsmith-autotoc\node_modules\async\lib\async.js:132:19)
    at C:\Path\Documentation\node_modules\metalsmith-autotoc\node_modules\async\lib\async.js:32:16
    at C:\Path\Documentation\node_modules\metalsmith-autotoc\index.js:139:9
    at C:\Path\Documentation\node_modules\metalsmith-autotoc\node_modules\async\lib\async.js:122:13
    at _each (C:\Path\Documentation\node_modules\metalsmith-autotoc\node_modules\async\lib\async.js:46:13)
    at Object.async.each (C:\Path\Documentation\node_modules\metalsmith-autotoc\node_modules\async\lib\async.js:121:9)
    at Ware.<anonymous> (C:\Path\Documentation\node_modules\metalsmith-autotoc\index.js:116:11)
    at Ware.<anonymous> (C:\Path\Documentation\node_modules\metalsmith\node_modules\wrap-fn\index.js:45:19)
    at Immediate.next (C:\Path\Documentation\node_modules\metalsmith\node_modules\ware\lib\index.js:85:20)
    at Immediate._onImmediate (C:\Path\Documentation\node_modules\metalsmith\node_modules\wrap-fn\index.js:121:18)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5) 'TypeError: Cannot read property \'split\' of undefined\n    at createInPageIndexes (C:\\Path\\Documentation\\node_modules\\metalsmith-lunr\\lib\\index.js:66:49)\n    at indexDocs (C:\\Path\\Documentation\\node_modules\\metalsmith-lunr\\lib\\index.js:43:27)\n    at Ware.<anonymous> (C:\\Path\\Documentation\\node_modules\\metalsmith-lunr\\lib\\index.js:11:5)\n    at Ware.<anonymous> (C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\wrap-fn\\index.js:45:19)\n    at next (C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\ware\\lib\\index.js:85:20)\n    at C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\wrap-fn\\index.js:121:18\n    at C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\index.js:142:7\n    at done (C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\node_modules\\async\\lib\\async.js:132:19)\n    at C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\node_modules\\async\\lib\\async.js:32:16\n    at C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\index.js:139:9\n    at C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\node_modules\\async\\lib\\async.js:122:13\n    at _each (C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\node_modules\\async\\lib\\async.js:46:13)\n    at Object.async.each (C:\\Path\Documentation\\node_modules\\metalsmith-autotoc\\node_modules\\async\\lib\\async.js:121:9)\n    at Ware.<anonymous> (C:\\Path\\Documentation\\node_modules\\metalsmith-autotoc\\index.js:116:11)\n    at Ware.<anonymous> (C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\wrap-fn\\index.js:45:19)\n    at Immediate.next (C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\ware\\lib\\index.js:85:20)\n    at Immediate._onImmediate (C:\\Path\\Documentation\\node_modules\\metalsmith\\node_modules\\wrap-fn\\index.js:121:18)\n    at runCallback (timers.js:794:20)\n    at tryOnImmediate (timers.js:752:5)\n    at processImmediate [as _immediateCallback] (timers.js:729:5)'

I found a related issue in the Particle docs repo (the Misty docs are based on their toolchain): particle-iot/docs#384

This comment is from one of the Particle engineers:

Sorry to say this isn't likely to be a simple fix. I don't think the Metalsmith static site generator and all the plugins we use are well tested on Windows."

The issue appears to be related to the metalsmith-lunr and/or lunr.js dependencies. If I remove references to these libraries from the metalsmith.js build script, then npm start works, and the site builds...but, it builds incorrectly, because we actually use those dependencies to build out the search functionality. Removing them screws up the build process and breaks search and other parts of the site.

Unfortunately, removing these dependencies is not a guaranteed fix. It appears that the Particle + Metalsmith toolchain isn't comprehensively tested on Windows to begin with, and there may be other problems that come up once this issue is resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions