全局NPM安装在OSX上失败

时间:2014-05-22 07:37:39

标签: node.js npm

我正在研究的项目的NPM安装有点麻烦。

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

的package.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

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

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

1 个答案:

答案 0 :(得分:11)

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

$ 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