Having troubles requiring another atom package


I am trying to develop a new package that will offer autocompletion for Laravel. I have a number of snippets setup and I want the snippets to execute via autocompletion. I don’t want to implement my own autocompletion, instead, I would like to implement autocompletion via autocomplete-plus’s suggestion provider implementation found here: https://github.com/saschagehlich/autocomplete-plus/wiki/Tutorial:-Registering-and-creating-a-suggestion-provider

I am running into problems when I try to require("autocomplete-plus") and the console is telling me

Failed to activate package named 'laravel4' Error: Cannot find module 'autocomplete-plus'

I have the package installed, but it looks like its looking for a node.jus module. Any pointers? Here is the troublesome line of code:

_ref = require("autocomplete-plus"), Provider = _ref.Provider, Suggestion = _ref.Suggestion;

@saschagehlich, perhaps you know what I am doing wrong?


Sadly, Atom packages when you install them in Atom do not behave like any other npm modules. They are not stored in a node_modules directory that the require method can reach.

But you can still access them using:

if path = atom.packages.getLoadedPackage('autocomplete-path')?.path
  {Provider, Suggestion} = require path 
  # Package not installed


@abe, that worked. Thanks!