我一直尝试试这个超级诡异的问题。 有一个项目中,我试图安装一个私人储存库 npm
命令。
这不起作用,当它在一个现有项目,但当它是一个新创建的项目,该项目刚刚创建 npm init
.
现有的项目是在 /app
和新的项目是在 /opt
(用于测试目的)
运行 npm add git+ssh://[email protected]:company/repository.git
在 /app
返回:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/company/repository.git
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-11-24T00_25_10_559Z-debug.log
运行完全相同的命令 /opt
项目的安装包装的正确没有任何问题。
我从一个阿尔卑斯山docker盒 openssh
安装。
这是的 Dockerfile
FROM node:16.13-alpine
RUN apk add --no-cache openssh-client git python2
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts && ln -s /run/secrets/ssh_key ~/.ssh/id_rsa && ln -s /run/secrets/ssh_pub_key ~/.ssh/id_rsa.pub
RUN mkdir /app
WORKDIR /app
一些更多的内容丰富的东西
/app # node -v
v16.13.0
/app # npm -v
8.1.4
/app # ssh -T [email protected]
Hi AzaZPPL! You've successfully authenticated, but GitHub does not provide shell access.
package.json
{
"name": "project",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"generate-schema": "node apollo/generate-schema.js",
"lint": "eslint --ext .js,.vue --ignore-path .eslintignore .",
"lintfix": "eslint --fix --ext .js,.vue --ignore-path .eslintignore ."
},
"dependencies": {
"@nuxtjs/apollo": "^4.0.1-rc.4",
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.2",
"@nuxtjs/dayjs": "^1.2.1",
"@nuxtjs/style-resources": "^1.0.0",
"apollo-cache-inmemory": "^1.6.6",
"copy-to-clipboard": "^3.3.1",
"core-js": "^3.6.5",
"date-fns": "^2.19.0",
"dotenv": "^8.2.0",
"filepond": "^4.27.1",
"filepond-plugin-file-validate-type": "^1.2.6",
"filepond-plugin-image-preview": "^4.6.6",
"graphql-tag": "^2.11.0",
"js-file-download": "^0.4.12",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.20",
"nuxt": "^2.14.6",
"nuxt-buefy": "^0.4.10",
"nuxt-i18n": "^6.15.4",
"vee-validate": "^3.4.3",
"vue": "^2.6.12",
"vue-filepond": "^6.0.3"
},
"devDependencies": {
"@babel/eslint-parser": "^7.16.3",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^7.1.0",
"prettier": "^2.1.2",
"sass": "^1.32.8",
"sass-loader": "^12.3.0"
}
}
任何想法什么在这里?