【问题标题】:npm not being able to find a file - sshpk-conv, errno -2 - Thinkster Angularnpm 找不到文件 - sshpk-conv,errno -2 - Thinkster Angular
【发布时间】:2018-04-04 22:33:39
【问题描述】:

我目前正在学习 thinkster.io 教程,在成功构建后端后,我继续对前端进行编程。我正在使用使用 vagrant 自动配置的 VM,我通过 ssh 访问它,并将我的本地 HDD 的一部分与 VM 的 HDD 的一部分同步(如果相关的话)。

我一开始是:

sudo apt-get install nodejs
sudo apt-get install build-essential
npm install -g @angular/cli

然后浏览到前端文件夹(package.json 所在的位置)并运行

npm install

只是被这个错误打招呼:

npm WARN deprecated angular-cli@1.0.0-beta.15: angular-cli has been renamed to @angular/cli. Please update your dependencies.
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
ang2-conduit@0.0.0 /vagrant/thinkster/angular2-realworld-example-app
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0
└── UNMET PEER DEPENDENCY @angular/core@2.0.0

npm WARN @angular/compiler-cli@4.4.6 requires a peer of @angular/compiler@4.4.6 but none was installed.
npm WARN @angular/compiler-cli@4.4.6 requires a peer of @angular/core@4.4.6 but none was installed.
npm WARN @angular/platform-server@2.4.10 requires a peer of @angular/core@2.4.10 but none was installed.
npm WARN @angular/platform-server@2.4.10 requires a peer of @angular/common@2.4.10 but none was installed.
npm WARN @angular/platform-server@2.4.10 requires a peer of @angular/compiler@2.4.10 but none was installed.
npm WARN @angular/platform-server@2.4.10 requires a peer of @angular/platform-browser@2.4.10 but none was installed.
npm WARN @angular/tsc-wrapped@4.4.6 requires a peer of typescript@^2.1.5 but none was installed.
npm WARN string-replace-loader@1.3.0 requires a peer of webpack@1 || 2 || 3 but none was installed.
npm WARN tsickle@0.21.6 requires a peer of typescript@^2.1.0 but none was installed.
npm WARN webpack-dev-middleware@1.12.0 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none was installed.
npm WARN @angular/compiler-cli@0.6.4 requires a peer of @angular/compiler@2.0.2 but none was installed.
npm WARN @angular/compiler-cli@0.6.4 requires a peer of @angular/platform-server@2.0.2 but none was installed.
npm WARN @angular/compiler-cli@0.6.4 requires a peer of @angular/core@2.0.2 but none was installed.
npm ERR! Linux 4.9.0-3-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! path /vagrant/thinkster/angular2-realworld-example-app/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/thinkster/angular2-realworld-example-app/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv'
npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/thinkster/angular2-realworld-example-app/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/thinkster/angular2-realworld-example-app/npm-debug.log
npm ERR! code 1

我尝试了在网上找到的各种方法,但似乎没有任何帮助。我对 npm 不太熟悉,因此我很难让它工作。任何人都可以帮忙吗?

这是 package.json:

{
  "name": "ang2-conduit",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "core-js": "^2.4.1",
    "marked": "^0.3.6",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/marked": "0.0.28",
    "angular-cli": "1.0.0-beta.15",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.5",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2"
  }
}

【问题讨论】:

    标签: json node.js angular npm


    【解决方案1】:

    我猜你是在一个流浪的虚拟机上?我的猜测是您将项目存储在与 Windows 主机共享的文件夹中。我看到模块失败是请求,这在很多情况下都让我失败了,无论是直接在 Windows 上还是在共享文件夹中。

    如果您真的在流浪虚拟机上,最好的选择是将虚拟机文件夹挂载到 node_modules 上。这将确保符号链接和链接按预期工作,因为它们将保留在同一系统上。

    为此,通过 SSH 连接到 VM,然后运行这些行:

    sudo mkdir -p /app_node_modules
    sudo mount --bind /app_node_modules /vagrant/thinkster/angular2-realworld-example-app/node_modules
    

    您必须知道 npm install 在基于 unix 的系统上执行所有任务,而托管文件的文件夹托管在具有不同功能的不同类型的系统上。

    this sshpk-conv issue 上找到了可能的解决方法

    我在使用 npm 4.1.2 时也遇到过类似的问题,但之后它就消失了 更新到最新的 4.6.1。该问题还有一个解决方法: npm install --no-bin-links;在这种情况下,npm 不会尝试 chmod 这些文件。

    【讨论】:

    • 我使用的是 Mac,VM 在 VirtualBox 中运行,但使用 vagrant 进行设置和配置。所以它应该是双方的unix系统。这有什么不同吗?
    • 它们都是基于 unix 的,但虚拟机可能无法相应地管理权限。我记得当我在基于 PHP 的软件上使用 Mac 时不得不调整文件夹的权限......请打开完整的日志,看看它到底在哪里失败。我的猜测是要创建一个符号链接,系统没有返回错误,但是文件不存在......但我只是在黑暗中投球......
    • 听起来很有道理,谢谢!这是要点gist.github.com/lterfloth/70303d9617125cb29300a1bdec26964e
    • 安装过程似乎在提取文件时停止。我指出了一个问题,即人们遇到了同样的问题,但文件首先被正确提取...既然它是一个垃圾箱,可能是你的防病毒软件阻止了它吗?
    • 禁用防病毒和防火墙并没有改变结果,遗憾的是......
    【解决方案2】:

    尝试更新依赖项并使用 -g 参数或 --global 对这些依赖项进行 npm 安装,然后尝试运行 npm run 命令。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-04
      • 1970-01-01
      • 2021-08-26
      • 2020-08-25
      相关资源
      最近更新 更多