If you are going through the Truffle TokenTutorial smart contract and you can’t run “npm run dev” because you get the following error below, it can be very frustrating.

You follow all the instructions to the letter but get this strange error such as: – Cannot find module ‘../lib/lite-server’
– ERR! tutorialtoken@1.0.0 dev: `lite-server`

Seans-MacBook-Pro:tokentutorial sean$ npm run dev

> tutorialtoken@1.0.0 dev /Users/sean/Dropbox/CodeDropBox/truffle/tokentutorial
> lite-server

    throw err;

Error: Cannot find module '../lib/lite-server'
Require stack:
- /Users/sean/Dropbox/CodeDropBox/truffle/tokentutorial/node_modules/.bin/lite-server
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object. (/Users/sean/Dropbox/CodeDropBox/truffle/tokentutorial/node_modules/.bin/lite-server:7:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:837:10) {
  requireStack: [
npm ERR! errno 1
npm ERR! tutorialtoken@1.0.0 dev: `lite-server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the tutorialtoken@1.0.0 dev 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!     /Users/sean/.npm/_logs/2019-06-09T09_13_38_647Z-debug.log


As with most computer problems, when all else fails, restart from the beginning. Here, a clean install of npm resolved this issue for me.

First, delete the node_module folder in your project directory and also the package-lock.json file.

Then run npm install again. Now you should be able to run “npm run dev” successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *