node.js - 在 OSX 上全局 NPM 安装失败

标签 node.js npm

我正在处理的项目的 NPM 安装有点麻烦。

npm install 在 VM 中针对 package.json 运行时可以找到。但是,当从主机 OSX 机器(不是共享文件夹或任何类似的冲突)运行时,安装会进入错误循环。

包.json:

{
  "name": "crowdtutor",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-autoprefixer": "~0.4.0",
    "grunt-bower-install": "~0.7.0",
    "grunt-concurrent": "~0.4.1",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-compass": "~0.6.0",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-cssmin": "~0.7.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.3.0",
    "grunt-contrib-jshint": "~0.7.1",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-google-cdn": "~0.2.0",
    "grunt-karma": "^0.8.2",
    "grunt-newer": "~0.5.4",
    "grunt-ngmin": "~0.0.2",
    "grunt-rev": "~0.1.0",
    "grunt-svgmin": "~0.2.0",
    "grunt-usemin": "~2.0.0",
    "jshint-stylish": "~0.1.3",
    "karma": "^0.12.1",
    "karma-chrome-launcher": "^0.1.2",
    "karma-jasmine": "^0.1.5",
    "karma-ng-html2js-preprocessor": "^0.1.0",
    "karma-ng-scenario": "^0.1.0",
    "karma-phantomjs-launcher": "^0.1.2",
    "load-grunt-tasks": "~0.2.0",
    "time-grunt": "~0.2.1",
    "compass": "^0.1.0",
    "grunt-cli": "^0.1.13",
    "mongo-hacker": "0.0.3"
  },
  "engines": {
    "node": ">=0.8.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

.npmrc:

registry = http://registry.npmjs.org/
dev = true
#fetch-retries = 120
strict-ssl = false
#tmp = /Users/matt/.npmtmp

npm install -g 的(无限循环的一部分)输出:

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/time-grunt/node_modules/text-table/node_modules/tap/test/deep.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/time-grunt/node_modules/text-table/node_modules/tap/test/deep.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/hooker/node_modules/grunt/lib/grunt.js'
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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/hooker/node_modules/grunt/lib/grunt.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/hooker/node_modules/grunt/lib/grunt.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/nodeunit'
npm ERR! error rolling back  grunt-jscs-checker@0.4.4 { [Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/nodeunit']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/nodeunit' }
npm http 200 http://registry.npmjs.org/serve-index
npm http 200 http://registry.npmjs.org/multiparty
npm http 304 http://registry.npmjs.org/hashish
npm http 304 http://registry.npmjs.org/findit
npm http 304 http://registry.npmjs.org/superagent
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/cliff/test/cliff-test.js'
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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/cliff/test/cliff-test.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/karma-coverage/node_modules/karma/node_modules/grunt-jscs-checker/node_modules/vow/node_modules/jspath/node_modules/cliff/test/cliff-test.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, utime '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/tap/node_modules/glob/node_modules/rimraf/fiber.js'
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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/tap/node_modules/glob/node_modules/rimraf/fiber.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-html2js-preprocessor/node_modules/grunt-bump/node_modules/grunt-contrib-nodeunit/node_modules/tap/node_modules/glob/node_modules/rimraf/fiber.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET http://registry.npmjs.org/emitter-component
npm http GET http://registry.npmjs.org/cookiejar
npm http GET http://registry.npmjs.org/methods
npm http GET http://registry.npmjs.org/reduce-component
npm http GET http://registry.npmjs.org/better-assert
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/chai/node_modules/mocha-phantomjs/node_modules/requirejs/bin/r.js'
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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/chai/node_modules/mocha-phantomjs/node_modules/requirejs/bin/r.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/karma-ng-scenario/node_modules/karma/node_modules/chai/node_modules/mocha-phantomjs/node_modules/requirejs/bin/r.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/crowdtutor/node_modules/grunt-newer/node_modules/grunt-cli/node_modules/findup-sync/node_modules/grunt/node_modules/glob/node_modules/tap/node_modules/glob/node_modules/minimatch/node_modules/sigmund/node_modules/tap'
npm ERR! error rolling back  glob@3.1.21 { [Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/crowdtutor/node_modules/grunt-newer/node_modules/grunt-cli/node_modules/findup-sync/node_modules/grunt/node_modules/glob/node_modules/tap/node_modules/glob/node_modules/minimatch/node_modules/sigmund/node_modules/tap']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/crowdtutor/node_modules/grunt-newer/node_modules/grunt-cli/node_modules/findup-sync/node_modules/grunt/node_modules/glob/node_modules/tap/node_modules/glob/node_modules/minimatch/node_modules/sigmund/node_modules/tap' }
npm http 304 http://registry.npmjs.org/express
npm http 304 http://registry.npmjs.org/utest
npm http 304 http://registry.npmjs.org/underscore
npm http 304 http://registry.npmjs.org/gently
npm http 200 http://registry.npmjs.org/d-utils
npm ERR! Error: ENOENT, utime '/usr/local/lib/node_modules/crowdtutor/node_modules/grunt-bower-install/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/rimraf/fiber.js'
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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /Users/matt/dev/crowdtutor/opa
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path /usr/local/lib/node_modules/crowdtutor/node_modules/grunt-bower-install/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/rimraf/fiber.js
npm ERR! fstream_path /usr/local/lib/node_modules/crowdtutor/node_modules/grunt-bower-install/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/rimraf/fiber.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET http://registry.npmjs.org/qs
npm http 304 http://registry.npmjs.org/wordwrap
npm http 304 http://registry.npmjs.org/color-parser
npm http 200 http://registry.npmjs.org/oop/-/oop-0.0.3.tgz
npm http 304 http://registry.npmjs.org/css
npm http 304 http://registry.npmjs.org/mime
npm http GET http://registry.npmjs.org/temp
npm http GET http://registry.npmjs.org/fstream
npm http GET http://registry.npmjs.org/binary
npm http 304 http://registry.npmjs.org/body-parser
npm http 304 http://registry.npmjs.org/rework-visit
npm http 304 http://registry.npmjs.org/bytes
npm http 304 http://registry.npmjs.org/rework-inherit
npm http 304 http://registry.npmjs.org/express-session

我的 NODE_PATH 设置为

/usr/local/bin/node

Node 是通过 brew 安装的,我在 Mavericks OSX 上。

我已经运行了 npm cache clean 并且确信这不是任何地方的权限问题。在我看来,那里似乎有一些循环的 :node_modules: 目录构建?救命!

最佳答案

偶然发现了同样的问题,我蛮力修复了它:

$ rm -r $HOME/.npm

# If the above fails, you can force remove this directory.
# BE CAREFUL though. If you make a typo, you can end up
# deleting files you care about.
$ rm -rf $HOME/.npm

紧随其后

npm cache clean
npm install -g grunt-cli

关于node.js - 在 OSX 上全局 NPM 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23800562/

相关文章:

ruby-on-rails - 在 Heroku 上的同一个应用程序中的 Rails 和 Node?

node.js - Express js 模块化 REST 框架

npm run <脚本名称> 不起作用

node.js - npm开始报错

node.js - 如何使用 MongoDB/NodeJS 进行大规模随机更新

c - 是否有一个模块可以将 node.js 绑定(bind)到 c 编译器?

javascript - Lambda/无服务器内联要求与 header 要求

ruby - 更新 gem 时 Docker 包安装缓存问题

node.js - npm 全局安装不使用 Node

ReactJS:如何找到依赖项,仍然通过主 react 包使用 PropTypes