Can't complete npm install when directing Docker to local NPM packages

Hi all,

I haven’t been able to find an answer to this question anywhere, so I’m hoping someone here might have run into a similar issue.

I’m trying to containerize a NodeJS application, but run into this error during RUN npm install:

npm ERR! Could not install from "packages/example-package" as it does not contain a package.json file

The package in question is listed as a local dependency in my app’s package.json:

"dependencies": {
    "@example-name/example-package": "file:../example-package"
  },

There are no issues running npm install outside of docker with these local file paths.

I’ve tried copying the packages package.json file into the container, via the Dockerfile, like so:

COPY ./packages/example-package/package.json ./packages/example-package

The resulting error is:

npm ERR! Could not install "packages/example-packages" as it is not a directory and is not a file with a name ending in .tgz, .tar.gz or .tar

I’m at a loss as to where to go from here! Any suggestions?

Thanks :slight_smile:

hello +1 same issue for me

any updates here? I got cb() never called when trying to use local npm

me too +1 same issue here