我一直在尝试从github存储库安装某些东西并在内部运行它。我在项目目录中使用了npm install github:openfn/core#v1.0.0
,将"core": "github:openfn/core#v1.0.0"
添加到了package.json中。但是,当我尝试使用docker build -t name .
构建docker容器时,出现以下警告,并最终出错:
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://git@github.com/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
从这里的其他帖子中,我已经看到未定义的ls-remote ...和spawn git可能与未安装git有关,但是如果我不使用docker,那我认为这是有道理的,但即使所以我确实已经安装了git,并且可以运行git clone,git --version等。正是由于这种依赖性,我一删除它就能够构建它并运行它而不会出现问题。有什么建议吗?
编辑: 我的Dockerfile看起来像这样:
FROM node:dubnium-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
CMD npm start
EXPOSE 4321
答案 0 :(得分:1)
我设法通过添加使其起作用:
RUN apk add --no-cache git
到dockerfile。无论如何,谢谢您的时间。