getappmap/appmap-agent-js

The officialy recommended command for installing AppMap for JavaScript (npx @appland/appmap@latest install) inside project's directory fails

Closed this issue · 3 comments

When I try to install appmap client for JavaScript inside my project, using recommended command: npx @appland/appmap@latest install after a while of installation process, I get error: Unexpected token '{'.

What's more interesting, is when I do the command npm install -g @appland/appmap@latest, the installation process end without any errors, because I can see the chromium is being downloaded and saved to .cache/puppeteer directory and other dependencies are also installed.

Dunno how to locate the source of this Unexpected token '{' error.

Ok, probably located the source of this error.

The npx [something] command is NPM's execution command, which executes the downloaded module immediately.

When I executed appmap install manually, I got the corresponding error:

$ appmap install
C:\Users\someUser\AppData\Roaming\nvm\v14.21.3\node_modules\@appland\appmap\node_modules\@octokit\core\dist-node\index.js:42
  static {
         ^

SyntaxError: Unexpected token '{'
    at compileFunction (<anonymous>)
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at Module.patchedRequire (C:\Users\someUser\AppData\Roaming\nvm\v14.21.3\node_modules\@appland\appmap\node_modules\diagnostic-channel\dist\src\patchRequire.js:16:46)
    at Module.Hook._require.Module.require (C:\Users\someUser\AppData\Roaming\nvm\v14.21.3\node_modules\@appland\appmap\node_modules\require-in-the-middle\index.js:188:39)
    at require (internal/modules/cjs/helpers.js:107:18)

The @octokit module is responsible for this error, then.

Hi @ar-IGT , thanks for submitting this issue - we will look into it.

In the meantime, the next generation of our Node agent is in alpha testing now, and it can be used without running a dedicated installation step beforehand. If you'd like to try it out, go to this repo and follow the instructions. Thanks!

I think I've found the solution, I had to change to Node.js v16, using Node Version Manager.
Now installation works.