Required package not found


I am following the hacking instruction
As in the instruction I have "require ‘figlet’ ". Atom won’t find it and I will paste the exception in the end.

  1. I already installed the package ‘figlet’ from within Atom. It shows in my installed package list
  2. I also tried installing from npm
  3. I can use figlet functionality from the command line
  4. In my project I already put the dependencies in package.son as “figlet”: “0.4.0”
  5. In the code I have figlet = require ‘figlet’ as in the instruction
  6. The downloaded figlet library existed under ~/.atom/, while my project is located on ~/Documents/workspace/. Does this matter?
  7. I tried reloading the view and restarting Atom

No matter what I tried, the exception is thrown. Looking for help… The exception is,

Error: Cannot find module ‘figlet’ at Module._resolveFilename (module.js:328:15)
at Function.Module._resolveFilename (/Applications/
at Function.Module._load (module.js:270:25)
at Module.require (module.js:357:17)
at require (module.js:376:17)
at Object.module.exports.MyAtomPackage0.toggle (/Users/mountain7cat/Documents/workspace/my-atom-package0/lib/
at (/Users/mountain7cat/Documents/workspace/my-atom-package0/lib/
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/
at CommandRegistry.handleCommandEvent (/Applications/
at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/
at EventEmitter. (/Applications/ at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:166:7)


The issue here is that there is as figlet Atom package and a figlet Node module. The one you need to have installed is the Node module. And if you notice the instructions state to add the following to your package.json:

"dependencies": {
  "figlet": "1.0.8"

Whereas you state that you declared the dependency as 0.4.0.

To correct the situation:

  1. Correct the package.json dependencies declaration
  2. Open a terminal window
  3. Navigate to the directory where the package.json is
  4. Execute the command apm install

Things should work better after that.


That works! The thing I missed was I did not run “apm install”. Thanks!