Need help with dependencies in plug-in development


#1

I am developing a plugin. I want to include the ‘text-buffer’ module. What I did in my code is,
{Point, Range} = require ‘text-buffer’ This line gives fail-to-load warning.

In the package.json I have
"dependencies": {
“space-pen”: “3.8.2”,
“text-buffer”: “5.2.0”
}

My Atom version is 0.199.0 which has corresponding dependencies for these two libraries as above. In my plugin folder I also ran “npm install” which ran fine with 3 warnings.

The actual error is as below. I did not figure out what are 43 and 14 yet. Did I do anything wrong in including dependencies?

Module version mismatch. Expected 43, got 14.
Hide Stack Trace
Error: Module version mismatch. Expected 43, got 14.
at Error (native)
at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:118:20)
at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:118:20)
at Module.load (module.js:347:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:357:17)
at require (module.js:376:17)
at Object. (/Users/Becky/Documents/workspace/my-atom-package0/node_modules/text-buffer/node_modules/pathwatcher/lib/main.js:6:13)
at Object. (/Users/Becky/Documents/workspace/my-atom-package0/node_modules/text-buffer/node_modules/pathwatcher/lib/main.js:207:4)
at Module._compile (module.js:452:26)


#2

What is it you’re trying to do with the text-buffer module? Also, I don’t think you have to include it as its own dependency if you’re building an Atom package. You should just be able to do:

{Point, Range} = require 'atom'

#3

I see. This works. I did not figure out this can be directly required from ‘atom’. I am trying to write a functionality to tell me what is the word my mouse is clicking on. Thanks for help.


#4

Glad you solved your problem :smile: But does it work when you use apm install instead of npm install?


#5

Yea. That also works. Good to know about this. Thanks.