Docker is trying to look for a local dependency in the npm registry

I’m trying to containerize a react app with a local dependency pretty much like this post. However, for my case, Docker doesn’t even attempt to look for the local dependency in the file system and instead throws this error:

npm ERR! code E404
npm ERR! 404 Not Found - GET - Not found
npm ERR! 404 
npm ERR! 404  '@my-local-package@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Also, just like the other post, I’m able to run npm install outside of Docker, and building a container seems to complete just fine. The problem comes when I try to run the image in a container that assumes my local dependency is in the npm registry in spite of defining it in my package.json like

"devDependencies": {
  "@my-local-package": "file:path/to/file",

Any kind of insight on what could be causing this would really be appreciated. Thanks!