我在Linux中安装npm时出错

时间:2019-04-12 13:04:34

标签: node.js linux git npm bitbucket

我已经搜索了很多论坛,已经找到了类似的内容,但我发现了类似的内容,但是没有一个帮助我。让你知道发生了什么事。

我刚刚安装了新鲜的ubuntu,然后安装了vim,git和node.js。现在我也想安装npm,但是然后出现错误。一堆tbh:

kuba@ubuntu:~/lgv$ npm install
npm WARN deprecated tsml@1.0.1: no longer maintained
npm WARN addRemoteGit Error: Command failed: git config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:275:12)
npm WARN addRemoteGit     at emitTwo (events.js:126:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:214:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:925:16)
npm WARN addRemoteGit     at Socket.stream.socket.on (internal/child_process.js:346:11)
npm WARN addRemoteGit     at emitOne (events.js:116:13)
npm WARN addRemoteGit     at Socket.emit (events.js:211:7)
npm WARN addRemoteGit     at Pipe._handle.close [as
    _onclose] (net.js:567:12)
npm WARN addRemoteGit  git+https://bitbucket.org/lgv-g12/lgv-config.git resetting remote /home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f because of error: { Error: Command failed: git config --get remote.origin.url
npm WARN addRemoteGit 
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:275:12)
npm WARN addRemoteGit     at emitTwo (events.js:126:13)
npm WARN addRemoteGit   at ChildProcess.emit (events.js:214:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:925:16)
npm WARN addRemoteGit    at Socket.stream.socket.on (internal/child_process.js:346:11)
npm WARN addRemoteGit     at emitOne (events.js:116:13)
npm WARN addRemoteGit   at Socket.emit (events.js:211:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:567:12)
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit  signal: null,
npm WARN addRemoteGit   cmd: 'git config --get remote.origin.url' }
npm ERR! git clone
    --template=/home/kuba/.npm/_git-remotes/_templates --mirror https://bitbucket.org/lgv-g12/lgv-config.git /home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f: Cloning into bare repository '/home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f'...
npm ERR! git clone --template=/home/kuba/.npm/_git-remotes/_templates
    --mirror https://bitbucket.org/lgv-g12/lgv-config.git /home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f: remote: Invalid username or password
npm ERR! git clone
    --template=/home/kuba/.npm/_git-remotes/_templates --mirror https://bitbucket.org/lgv-g12/lgv-config.git /home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f: fatal: Authentication failed for 'https://bitbucket.org/lgv-g12/lgv-config.git/'
npm ERR! Linux
    4.18.0-15-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v8.10.0 npm ERR! npm  v3.5.2
npm ERR! code 128

npm ERR! Command failed: git clone
    --template=/home/kuba/.npm/_git-remotes/_templates --mirror https://bitbucket.org/lgv-g12/lgv-config.git /home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f
npm ERR! Cloning into bare repository '/home/kuba/.npm/_git-remotes/git-https-bitbucket-org-lgv-g12-lgv-config-git-d9c0735f'...
npm ERR! remote: Invalid username or password
npm ERR! fatal: Authentication failed for 'https://bitbucket.org/lgv-g12/lgv-config.git/'
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/kuba/lgv/npm-debug.log
kuba@ubuntu:~/lgv$

也许你知道我搞砸了。我已经从那些错误的secound linux机器上获取了所有错误,并且没有什么能真正帮助我解决问题。

1 个答案:

答案 0 :(得分:2)

在使用apt-get的Ubuntu计算机(和Debian等)上,通过以下方式安装npm:

sudo apt-get install npm

您使用了命令

npm install

此命令用于安装package.json中声明的node.js项目的依赖项。