Help Docs

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.
Note

After uninstalling the agent, the agent-related configuration files and logs will not be deleted automatically; you need to delete them manually.

Related article

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.


We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.


Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!