Docker Community Forums

Share and learn in the Docker community.

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

docker

(Acc25) #1

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:


(Lastnod) #2

hello +1 same issue for me