1

I am trying to use the Atom text editor for Processing development in Windows, and am having some issues. Internet restrictions at work mean I cannot use the built-in package manager within Atom:

Fetching featured packages failed: connect ECONNREFUSED

Therefore, I need to install packages manually. I am trying to use bleikamp's Processing package for atom which allows the running of processing sketches, and have unzipped the package, downloaded from github, in the packages folder - C:\Users\my_username\.atom\packages.

The package is detected within Atom as being installed, but when I try and run a sketch, the below error occurs:

Failed to activate the processing package

Cannot find module 'ps-tree'

Error: Cannot find module 'ps-tree'
    at Module._resolveFilename (module.js:455:15)
    at Module._resolveFilename (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\electron.asar\common\reset-search-paths.js:35:12)
    at Function.Module._resolveFilename (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (file:///C:/Users/chris.hamilton/.atom/packages/processing-master/lib/processing.coffee:4:10)
    at Object.<anonymous> (file:///C:/Users/chris.hamilton/.atom/packages/processing-master/lib/processing.coffee:1:1)
    at Module._compile (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\native-compile-cache.js:109:30)
    at Object.value [as .coffee] (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\compile-cache.js:216:21)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\package.js:796:27)
    at Package.module.exports.Package.activateNow (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\package.js:207:16)
    at C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\package.js:876:25
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\node_modules\event-kit\lib\emitter.js:129:28)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\command-registry.js:240:20)
    at C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:599:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:390:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\window-event-handler.js:106:36)
    at HTMLDocument.<anonymous> (C:\Users\chris.hamilton\AppData\Local\atom\app-1.14.4\resources\app.asar\src\window-event-handler.js:3:59)

I assume this is an issue with dependencies and I am probably missing a step in manually installing the package - can anyone offer any guidance? I have researched fairly extensively into manually installing packages, and there is a lot of information about using commands such as apm link and apm install, but I can't seem to access these commands.

EDIT: I have included processing-java in my PATH variable. Below is the output when path is called from cmd:

PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\ProgramData\Oracle\Java\javapath;C:\WIN
DOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPow
erShell\v1.0\;C:\Program Files (x86)\Microsoft Office\Office14\;C:\Program Files
 (x86)\Enterprise Vault\EVClient\;C:\Program Files\Hummingbird\Connectivity\14.0
0\NFS Maestro\;C:\Program Files (x86)\Hummingbird\Connectivity\14.00\NFS Maestro
\;C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v713\runtime\win32;C:\WI
NDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Autodesk Sh
ared\;C:\Program Files\MATLAB\MATLAB Runtime\v90\runtime\win64;C:\Program Files\
TortoiseSVN\bin;C:\ChrisHamilton\Room_Results_Comparison\processing-3.2.1\;C:\Us
ers\chris.hamilton\AppData\Local\atom\bin

Any help would be much appreciated.

Chris Hamilton
  • 555
  • 5
  • 21

2 Answers2

2

As you have guessed already, missing package dependencies are causing this error. Since you don't seem to have internet connection (or limited connection) at work, I'd recommend installing the Processing package where you are online (e.g. at home), then compress the processing folder and extract it inside the Atom packages folder at work. Make sure the processing folder includes node_modules. Optionally repeat those steps for the script package.

Dependencies are installed running apm install (or npm install) inside the package folder. Whenever an Atom package has dependencies, this step is essential. Atom (or apm) are doing this automatically.

To give you some more insights into the process, here's an alternative way to install a package with dependencies:

cd %USERPROFILE%.atom\packages
git clone https://github.com/bleikamp/processing
cd processing
npm install
idleberg
  • 10,319
  • 7
  • 36
  • 57
  • I'll try this this evening, thank you - I assume by "the folder" you mean the packages directory? – Chris Hamilton Mar 13 '17 at 15:39
  • I meant the `processing` folder (and optionally `script`) inside the Atom package folder – idleberg Mar 13 '17 at 15:44
  • Yep I see - I'll do so later, thanks. Regarding `apm install`/`npm install`, these commands aren't recognised when I open a command line in the package folder. – Chris Hamilton Mar 13 '17 at 15:46
  • 1
    apm comes with Atom. If `apm` isn't available in `cmd.exe`, try running *Install Shell Commands* from the Atom [command palette](https://atom.io/docs/latest/getting-started-atom-basics#command-palette) or the menu. – idleberg Mar 13 '17 at 15:50
  • There's no results for "Install Shell Commands" in the command palette. – Chris Hamilton Mar 13 '17 at 15:54
  • Ah I see. I'll try and set up the whole environment at home and transfer across. – Chris Hamilton Mar 13 '17 at 17:43
  • I have installed at home, which has worked - I am no longer getting the error, but it is now refusing to run any Processing sketches. The error now is `'processing-java' is not recognized as an internal or external command, operable program or batch file.`. As I've said - I have added the Processing directory to the `PATH` variable - any further suggestions? – Chris Hamilton Mar 13 '17 at 20:37
  • Does `processing-java` or `processing-java --help` work separately, e.g. in the command prompt? – codemacabre Mar 14 '17 at 09:21
  • @ChrisHamilton IMHO you should open a new question for this and not add extend it further – idleberg Mar 14 '17 at 09:24
1

It looks like you're running Windows and processing-java hasn't been added to your PATH. Try the following:

  • Open Advanced System Settings either by running sysdm.cpl or searching in Control Panel.
  • Click the Environment Variable button on the Advanced tab.
  • Edit the PATH variable to include the Processing directory (e.g. C:\Program Files\Processing-3.1.1\) in either the User variables (for just your account) or System variables (for all users).

Also note that bleikamp no longer maintains his Processing package and instead recommends using Script.

codemacabre
  • 882
  • 10
  • 20
  • I forgot to mention that I've already done this - will edit the question. Can I just clarify what you mean by to **include** the Processing directory? Should the `PATH` variable have more than one path in it? I looked at the Script package and will try this, but could you explain the `apm install script` command the installation guide mentions? I can't run this command. – Chris Hamilton Mar 13 '17 at 15:21
  • You just need to add the Processing directory to the list of directories already in your `PATH`. See [here](http://stackoverflow.com/questions/9546324/adding-directory-to-path-environment-variable-in-windows). If your `PATH` only has one variable, it sounds like something you did stripped your PATH (which could explain why `apm install script` doesn't work. – codemacabre Mar 13 '17 at 15:35
  • Ok - it only shows one variable in the Advanced System Settings dialogue, but the output of the `path` command shows multiple, including the Processing path I added (See recent edit to question). – Chris Hamilton Mar 13 '17 at 15:42