Updation of Node.js packages in different directories in Docker images

Hi All,
I have some Vulnerabilities at different locations in my docker image when i run an updated install it goes into ./usr/local/lib/node_modules .i have to copy this directory with latest install into the locations having vulnerability and remove the directory present at that loaction,is there a more suitable way to remediate these vulns?