If you are upgrading both the Controller and agents, first upgrade the Controller and then upgrade the agents.
Also, if you are upgrading multiple agents in your monitored environment, upgrade the agents for the tiers on which business transactions originate last. For more information about this requirement, along with Controller and agent compatibility information, see Agent and Controller Compatibility.
To upgrade the Node.js agent:
From the root directory of the application for which you want to upgrade the agent, uninstall the old version of the agent by entering:
npm uninstall appdynamics
From the same directory install the new version by entering:
npm install appdynamics@<version>
The version is the three-digit version number of the new version that you are installing; for example, 4.1.1.