node-jxa icon indicating copy to clipboard operation
node-jxa copied to clipboard

The 2.1.2 release on NPM includes a reference to a developer-local directory (and doesn't correspond to the Github tag)

Open decadent opened this issue 6 years ago • 2 comments

Hi. If you install the current (2.1.2) release from NPM, you'll get an error when Node-jxa runs osacompile:

osacompile: couldn't write to file /Users/john/code/node-jxa/deleteme.scpt: No such file or directory

The vars at the top of node-jxa.js look like this in that release:

const HEAD = 'window = this;\nObjC.import("stdlib");\ntry {\n ';
const TAIL = ';\n} catch (e) {\n console.log( e.message );\n $.exit(1); \n}\n$.exit(0);';
const OSA_JXA_CMD = 'osacompile';
const OSA_JXA_CMD_ARGS = ['-l', 'JavaScript', '-o', '/Users/john/code/node-jxa/deleteme.scpt' ];

You can check code in NPM's module package by getting the archive address with npm view node-jxa dist.tarball and downloading the archive.

My guess is you might want to republish the release if NPM allows that, because code for the release seems to be different here on Github.

decadent avatar Jan 01 '19 23:01 decadent

I experienced the same. Installing with npm leads to the 'deleteme.scpt' error you mentioned, and like you, it points to the developer's local user path. Copying the contents of GitHub's node-jxa.js over the top of the installation's script of the same name fixed it, but that shouldn't be necessary obviously.

heathf avatar Feb 06 '19 01:02 heathf

You can use npm as it is by changing the package.json's dependencies as shown below.

(Because github's source code is imported as is.)

  "dependencies": {
    ...
    "node-jxa": "github:johnelm/node-jxa#v2.1.2"
    ...
  },

jopemachine avatar Jun 25 '20 23:06 jopemachine