Uninstall the Node.js Agent
To uninstall the APM Insight Node.js agent:
- Open your Node.js application.
- Navigate to the application root directory of the application from which you want to uninstall the agent.
- Enter the below command:
$ npm uninstall apminsight - Run the following command to confirm that APM Insight has been removed:
$ npm list | grep apminsight - 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.
- Delete the apminsightdata folder if it exists (located in the application's root directory).
- 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(); - 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 - 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
