Skip to content

npm start doesn't always work the first time #170

@johnathanDOS

Description

@johnathanDOS

The first time you do npm start to build a local version of the docs site, you may get an error that looks like this:

> node ./scripts/server.js

module.js:549
    throw err;
    ^

Error: Cannot find module 'metalsmith-redirect'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\Johnathan\Desktop\mistydoc\Documentation\scripts\redirects.js:2:16)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Path\Documentation\scripts\metalsmith.js:28:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Path\Documentation\scripts\server.js:1:76)
    at Module._compile (module.js:652:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! particle-docs@0.3.0 start: `node ./scripts/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the particle-docs@0.3.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Path\npm-cache\_logs\2020-05-12T15_29_17_088Z-debug.log

To workaround the issue:

  1. Delete the node_modules directory
  2. Redo npm install
  3. Retry npm start

The site should build and you should see it at localhost:8080

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions