Uninstall the Node.js Agent

To uninstall the APM Insight Node.js agent:

  1. Open your Node.js application.
  2. Navigate to the application root directory of the application from which you want to uninstall the agent.
  3. Enter the below command:
    $ npm uninstall apminsight 
  4. Run the following command to confirm that APM Insight has been removed:
    $ npm list | grep apminsight
  5. Delete the apminsightnode.json file, which contains details such as the license key and application name (if present), or delete any related environment variables that were configured.
  6. Delete the apminsightdata folder if it exists (located in the application's root directory).
  7. Remove the respective import or require statement from your Node.js application start file.
    JavaScript  Code snippet 
    Common JS require('apminsight');
    ECMAScript import apminsight from 'apminsight';
    TypeScript

    import AgentAPI from apminsight';
    AgentAPI.config();

  8. If the agent was configured using NODE_OPTIONS, remove the below configuration from the package.json file:
    NODE_OPTIONS="-r apminsight"
    Or, delete the command shown below, which you added during the APM Node.js agent installation:
    node -r apminsight my-start-file.js
  9. Restart the Node.js application.

Related article

Shortlink has been copied!