npm本地安装首次尝试失败

时间:2014-10-21 17:06:46

标签: node.js npm

背景

我有package.json一堆开发依赖项 我使用本地安装即npm install和我的package.json

node -v v0.10.26
npm -v 1.4.4
Windows 7 x32bit

问题

在新的第一次尝试时没有./node_modules存在(即新鲜)我得到各种错误。 其中一些与npm_cache和锁有关,我说我需要以管理员身份运行。为什么呢?
为什么后续npm install成功。

问题

  • 为什么后续安装应该成功?我不感兴趣为什么他们失败了 - 可能有各种各样的原因,也许每个都需要妥善处理。

  • 手动删除本地./node_modules文件夹会导致与此主题相关的任何问题吗?

更新:按要求添加以下部分

日志/参考

的package.json

{
  "name": "XXXXX-XXXX-XXXX",
  "version": "0.0.2",
  "dependencies": {
    "angular": "1.3.0-beta.14",
    "ng-grid": "2.0.11",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.10.2",
    "bootstrap": "~3.0.3",
    "angular-resource": "1.3.0-beta.14",
    "angular-route": "1.3.0-beta.14",
    "angular-bootstrap": "~0.11.0",
    "jquery-ui": "~1.10.4",
    "angular-animate": "1.3.0-beta.14",
    "tinymce": "~4.1.2",
    "angular-ui-tinymce": "~0.0.5"
  },
  "devDependencies": {
    "angular-mocks": "1.3.0-beta.14",
    "angular-scenario": "1.3.0-beta.14"
  },
  "resolutions": {
    "angular": "1.3.0-beta.14",
    "tinymce": "~4.1.2",
    "angular-mocks": "1.3.0-beta.14",
    "angular-scenario": "1.3.0-beta.14"
  }
}

npm install output snippet

npm ERR! error rolling back Error: EPERM, unlink 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\download-status\node_modu
    les\lpad-align\node_modules\max-component\node_modules\to-function\node_modules\remove-try-require\node_modules\ast-transform\node_modules\escodegen\escodegen.bro
    wser.min.js'
    npm ERR! error rolling back  download@3.1.0 { [Error: EPERM, unlink 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\downlo
    ad-status\node_modules\lpad-align\node_modules\max-component\node_modules\to-function\node_modules\remove-try-require\node_modules\ast-transform\node_modules\esco
    degen\escodegen.browser.min.js']
    npm ERR! error rolling back   errno: 50,
    npm ERR! error rolling back   code: 'EPERM',
    npm ERR! error rolling back   path: 'C:\\Users\\my.userid\\Documents\\clients\\merge.0.0.1\\tps-clients\\tps-web-app\\node_modules\\grunt-contrib-imagemin\\nod
    e_modules\\imagemin\\node_modules\\imagemin-pngquant\\node_modules\\pngquant-bin\\node_modules\\bin-build\\node_modules\\download\\node_modules\\download-status\\
    node_modules\\lpad-align\\node_modules\\max-component\\node_modules\\to-function\\node_modules\\remove-try-require\\node_modules\\ast-transform\\node_modules\\esc
    odegen\\escodegen.browser.min.js' }
    npm http 200 https://registry.npmjs.org/ast-types
    npm http GET https://registry.npmjs.org/source-map/0.1.32
    npm http 304 https://registry.npmjs.org/source-map/0.1.32
    npm http GET https://registry.npmjs.org/estraverse
    npm http GET https://registry.npmjs.org/is-relative
    npm http GET https://registry.npmjs.org/wrappy
    npm http 304 https://registry.npmjs.org/estraverse
    npm http 304 https://registry.npmjs.org/is-relative
    npm http 304 https://registry.npmjs.org/wrappy
    npm http GET https://registry.npmjs.org/ast-types/-/ast-types-0.3.38.tgz
    npm http GET https://registry.npmjs.org/cls/-/cls-0.1.5.tgz
    npm http GET https://registry.npmjs.org/private/-/private-0.1.5.tgz
    npm ERR! Error: ENOENT, lstat 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_mod
    ules\asn1'
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>
    npm ERR! System Windows_NT 6.1.7601
    npm ERR! command "C:\\My_Data\\devenv\\node\\\\node.exe" "C:\\My_Data\\devenv\\node\\node_modules\\npm\\bin\\npm-cli.js" "install"
    npm ERR! cwd C:\Users\REPLACED_PATH
    npm ERR! node -v v0.10.26
    npm ERR! npm -v 1.4.4
    npm ERR! path C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modules\asn1
    npm ERR! fstream_path C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modules\asn1

    npm ERR! fstream_unc_path \\?\C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modu
    les\asn1
    npm ERR! fstream_type Directory
    npm ERR! fstream_class DirWriter
    npm ERR! code ENOENT
    npm ERR! errno 34

1 个答案:

答案 0 :(得分:0)

正如@Julian H. Lam所评论的那样,问题在于Windows 7操作系统处理文件和文件夹权限的方式。

以管理员身份运行cmd后,我不再看到它了。