Atom local modules in package development


I am trying to write a package, so i want to use the snippets (one that comes with atom) package.
So i added

"dependencies": {
    "snippets": "0.x"

to package.json.

And then i ran apm install from cwd. But it installed some package from npm not the atom one…

I also tried just using

var n = require('snippets')

without the above steps, then i am gettings "Module not found error’ for snippets.

So what is the right way for using atom packages


You need to run apm update first.


Still it is not working
I deleted the node_module folder and ran apm update

But this is installing git://


Sorry about that, the command is apm install


You should use PackageManager ( which is accessible via atom.packages ( Then, you should use some API exposed by the package to interact with it.

Naturally that begs the question ‘what’s the API’ and there may not be one. Which is a perfect opportunity for a pull request to add one :smile:.


Also, if you do want to continue with the approach of requiring the package and using a package.json dependency, try using a git dependency rather than the package name (e.g.


I used atom.packages.activePackages.snippets.mainModule.api()

Thank you :smile: