magp
magp

Reputation: 305

NPM install something from github within a docker container fails

I have been trying to install something from a github repository and run it inside. I used npm install github:openfn/core#v1.0.0 in my project directory which added "core": "github:openfn/core#v1.0.0" to the package.json. However when I try to build the docker container with docker build -t name . I get the following warnings and eventually error :

npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/pino-pretty-fddda985/.travis.yml'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/files/types.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/util.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/files/utils.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/no-unsupported-features/node-builtins.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/filter.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/process.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended-module.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended-script.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/ajv-2fba4683/dist/ajv.min.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/strip-import-path-params.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/text-decoder.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/text-encoder.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/url-search-params.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/url.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/visit-import.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/visit-require.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/getIterator.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/Heap.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/initialParams.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/prettier-21fddb45/doc.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/isArrayLike.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/iterator.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/map.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/once.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/onlyOnce.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/parallel.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/promiseCallback.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/queue.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/range.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/reject.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/setImmediate.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/withoutIndex.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/wrapAsync.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/dist/async.mjs'
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/openfn/core.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

From other posts here, I have seen that the undefined ls-remote... and spawn git probably has something to do with not having git installed, however I think that would make sense if I was not using docker, but even so I do have git installed and can run git clone, git --version and so on. It is because of this dependency, as soon as I remove it, I am able to build it and run it without issues. Any suggestions?

EDIT: My Dockerfile looks like this:

FROM node:dubnium-alpine

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm install

COPY . .

CMD npm start 

EXPOSE 4321

Upvotes: 3

Views: 3783

Answers (1)

magp
magp

Reputation: 305

I managed to have it working by adding:

RUN apk add --no-cache git

to the dockerfile. Thanks anyway for your time.

Upvotes: 13

Related Questions