I'm trying to build a Docker image for a react js app with a local dependency similar to this post. My problem is when I try to build and run an image, it gives me this error:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@my-local-package - 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.
While it's clearly trying to locate the dependency from npm registry, I don't understand why. I'm defining it's location in my package.json to be in the file system:
"@stchdev/sdk": "file:.yalc/@my-local-package"
(I'm using yalc to publish my dependency locally which creates a .yalc folder with the build files inside of the main application. I copy these files to my Docker image as well).
Running npm install
on my local machine resolves the dependencies just fine and it only seems to look for it remotely in the docker file. How do I tell npm in the docker file that it should look for the dependency in the file system?