Npm files installation broken

my bot was working before, until suddenly it starting giving this error in the console:

Error: Cannot find module './lib/canvas'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/rbd/pnpm-volume/42e1fa5e-1f2a-48b9-b318-ecaceae267cd/node_modules/text2png/node_modules/canvas/index.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
internal/modules/cjs/loader.js:670
    throw err;
    ^

I’ve had this issue before, but I just reinstall canvas and it solves the problem.
However, when I run npm i canvas, I get another error for permissions that I’ve previously never had:

npm ERR! path /app/node_modules/tui-image-editor/node_modules/core-js/npm- 
shrinkwrap.json
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/app/node_modules/tui-image- 
editor/node_modules/core-js/npm-shrinkwrap.json'
npm ERR!  { [OperationalError: EACCES: permission denied, open 
'/app/node_modules/tui-image-editor/node_modules/core-js/npm-shrinkwrap.json']
npm ERR!   cause:
npm ERR!    { [Error: EACCES: permission denied, open '/app/node_modules/tui- 
image-editor/node_modules/core-js/npm-shrinkwrap.json']
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'open',
npm ERR!      path:
npm ERR!       '/app/node_modules/tui-image-editor/node_modules/core-js/npm-shrinkwrap.json' },
npm ERR!   isOperational: true,
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, open '/app/node_modules/tui-image-editor/node_modules/core-js/npm-shrinkwrap.json'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path:
npm ERR!    '/app/node_modules/tui-image-editor/node_modules/core-js/npm- shrinkwrap.json',
npm ERR!   parent: 'tui-image-editor' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/11.14.0/_logs/2020-04-03T13_47_27_077Z-debug.log

well i fixed the issue by deleting package-lock.json and copy-pasting a previous version of it onto my bot. However, I don’t think that is the proper fix. Can anyone explain to me what the proper fix for this issue should’ve been?