安装gulp browserify始终给出错误

时间:2014-07-08 06:55:23

标签: linux node.js npm gulp

我尝试使用此命令安装gulp-browserify:

npm install gulp-browserify --save-dev

我已经成功安装了许多其他软件包,例如

gulp-autoprefixer
gulp-concat
gulp-minify-css
gulp-sass
gulp-uglify

所有这些安装都运行良好,这是我的package.json文件的样子

{
  "devDependencies": {
    "gulp-autoprefixer": "0.0.8",
    "gulp-sass": "~0.7.2",
    "gulp": "~3.8.5",
    "gulp-minify-css": "~0.3.6",
    "gulp-concat": "~2.2.0",
    "gulp-uglify": "~0.3.1"
  }
}

以下是安装browserify时出现的错误

http GET https://registry.npmjs.org/uglify-to-browserify
npm http 200 https://registry.npmjs.org/inline-source-map
npm http GET https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.3.0.tgz
npm ERR! Error: invalid version: 3001.0001.0000-dev-harmony-fb
npm ERR!     at validVersion (/usr/lib/nodejs/read-package-json/read-json.js:573:40)
npm ERR!     at final (/usr/lib/nodejs/read-package-json/read-json.js:323:23)
npm ERR!     at /usr/lib/nodejs/read-package-json/read-json.js:139:33
npm ERR!     at cb (/usr/lib/nodejs/slide/lib/async-map.js:48:11)
npm ERR!     at /usr/lib/nodejs/read-package-json/read-json.js:251:40
npm ERR!     at fs.js:268:14
npm ERR!     at /usr/lib/nodejs/graceful-fs/graceful-fs.js:103:5
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /media/tzookb/dynamic/www/meeters/npm-debug.log npm

npm ERR! System Linux 3.11.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "gulp-browserify" "--save-dev"
npm ERR! cwd /media/tzookb/dynamic/www/meeters
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm http 200 https://registry.npmjs.org/escodegen
npm http GET https://registry.npmjs.org/escodegen/-/escodegen-1.1.0.tgz
npm http 200 https://registry.npmjs.org/callsite
npm http GET https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz
npm http 200 https://registry.npmjs.org/resolve/-/resolve-0.3.1.tgz
npm http 200 https://registry.npmjs.org/astw
npm http GET https://registry.npmjs.org/astw/-/astw-1.1.0.tgz
npm http 200 https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.5.tgz
npm http 200 https://registry.npmjs.org/convert-source-map/-/convert-source-map-0.3.4.tgz
npm http 200 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/source-map/-/source-map-0.1.34.tgz
npm http 200 https://registry.npmjs.org/source-map
npm http 200 https://registry.npmjs.org/uglify-to-browserify
npm http GET https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz
npm http 200 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/async/-/async-0.2.10.tgz
npm http 200 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz
npm http 200 https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.3.0.tgz
npm http 200 https://registry.npmjs.org/escodegen/-/escodegen-1.1.0.tgz
npm http 200 https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz
npm http 200 https://registry.npmjs.org/astw/-/astw-1.1.0.tgz
npm http 200 https://registry.npmjs.org/source-map/-/source-map-0.1.34.tgz
npm http 200 https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz
npm http 200 https://registry.npmjs.org/async/-/async-0.2.10.tgz
npm http 200 https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz
npm http GET https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz
npm http 200 https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/amdefine
npm http 200 https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz
npm http 200 https://registry.npmjs.org/amdefine
npm http GET https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz
npm http 200 https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz
npm http 200 https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz
npm ERR! Error: ENOENT, lstat '/media/tzookb/dynamic/www/meeters/node_modules/gulp-browserify/node_modules/browserify/node_modules/umd/node_modules/ruglify/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /media/tzookb/dynamic/www/meeters/npm-debug.log npm

npm ERR! System Linux 3.11.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "gulp-browserify" "--save-dev"
npm ERR! cwd /media/tzookb/dynamic/www/meeters
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! path /media/tzookb/dynamic/www/meeters/node_modules/gulp-browserify/node_modules/browserify/node_modules/umd/node_modules/ruglify/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js
npm ERR! fstream_path /media/tzookb/dynamic/www/meeters/node_modules/gulp-browserify/node_modules/browserify/node_modules/umd/node_modules/ruglify/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /media/tzookb/dynamic/www/meeters/npm-debug.log
npm ERR! not ok code 0

1 个答案:

答案 0 :(得分:7)

您运行的是哪个版本的节点?当您尝试在较旧版本的节点上安装较新的模块时,通常会出现这种错误。

1 - rm -rf node_modules

2 - 将节点更新到最新版本

  2.1 - sudo npm cache clean -f
  2.2 - sudo npm install -g n
  2.3 - sudo n stable

3 - 尝试再次安装gulp-browsify