Browserify无法在Node.Js / Mac上正确安装

时间:2014-11-09 16:35:37

标签: node.js browserify

我正在尝试在我的系统上全局安装Browserify,因此我可以从我的js文件中运行Node.Js模块。当我做的时候

sudo npm install -g browserify

然后开始安装,然后出现错误:

npm http 304 https://registry.npmjs.org/buffer
npm ERR! Error: No compatible version found: browser-resolve@'^1.3.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.0","0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.1.0","0.1.1","1.0.0","1.0.1","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4","1.3.0","1.3.1","1.3.2","1.4.0","1.4.1"]
npm ERR!     at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:682:10)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/cache.js:597:10
npm ERR!     at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /Users/deemeetree/Documents/Root/InfraNodus
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14

你知道我还能尝试什么,为什么它不起作用?

2 个答案:

答案 0 :(得分:1)

您使用的是哪种操作系统? 我刚刚做到了,它完美无缺(我正在使用OSX)。

$ npm install -g browserify
/usr/local/bin/browserify -> /usr/local/lib/node_modules/browserify/bin/cmd.js
browserify@6.2.0 /usr/local/lib/node_modules/browserify
├── https-browserify@0.0.0
├── tty-browserify@0.0.0
├── builtins@0.0.7
├── constants-browserify@0.0.1
├── path-browserify@0.0.0
├── process@0.8.0
├── os-browserify@0.1.2
├── isarray@0.0.1
├── inherits@2.0.1
├── commondir@0.0.1
├── string_decoder@0.10.31
├── stream-browserify@1.0.0
├── defined@0.0.0
├── domain-browser@1.1.3
├── shell-quote@0.0.1
├── shallow-copy@0.0.1
├── xtend@3.0.0
├── deep-equal@0.2.1
├── assert@1.1.2
├── querystring-es3@0.2.1
├── punycode@1.2.4
├── url@0.10.1
├── util@0.10.3
├── events@1.0.2
├── timers-browserify@1.1.0 (process@0.5.2)
├── parents@0.0.3 (path-platform@0.0.1)
├── vm-browserify@0.0.4 (indexof@0.0.1)
├── console-browserify@1.1.0 (date-now@0.1.4)
├── readable-stream@1.0.33 (core-util-is@1.0.1)
├── http-browserify@1.7.0 (Base64@0.2.1)
├── subarg@1.0.0 (minimist@1.1.0)
├── deps-sort@1.3.5 (through2@0.5.1, minimist@0.2.0)
├── resolve@0.7.4
├── browser-resolve@1.4.1
├── through2@1.1.1 (xtend@4.0.0, readable-stream@1.1.13)
├── buffer@2.8.1 (ieee754@1.1.4, base64-js@0.0.7, is-array@1.0.1)
├── shasum@1.0.0 (json-stable-stringify@0.0.1)
├── duplexer2@0.0.2 (readable-stream@1.1.13)
├── concat-stream@1.4.6 (typedarray@0.0.6, readable-stream@1.1.13)
├── labeled-stream-splicer@1.0.0 (stream-splicer@1.3.1)
├── JSONStream@0.8.4 (through@2.3.6, jsonparse@0.0.5)
├── syntax-error@1.1.1 (esprima-fb@3001.1.0-dev-harmony-fb)
├── glob@4.0.6 (graceful-fs@3.0.4, once@1.3.1, minimatch@1.0.0)
├── browser-pack@3.2.0 (through2@0.5.1, combine-source-map@0.3.0)
├── umd@2.1.0 (through@2.3.6, rfile@1.0.0, ruglify@1.0.0, uglify-js@2.4.15)
├── browserify-zlib@0.1.4 (pako@0.2.5)
├── crypto-browserify@3.3.0 (ripemd160@0.2.0, pbkdf2-compat@2.0.1, browserify-aes@0.4.0, sha.js@2.2.6)
├── module-deps@3.5.6 (minimist@0.2.0, stream-combiner2@1.0.2, parents@1.0.0, subarg@0.0.1, JSONStream@0.7.4, through2@0.4.2, detective@3.1.0)
└── insert-module-globals@6.1.0 (process@0.6.0, through@2.3.6, JSONStream@0.7.4, lexical-scope@1.1.0)

$ browserify -v
6.2.0

你可以再试一次吗?也许这是一个暂时的问题(似乎是旧版浏览器的问题 - 解决)。但是,如果您发现类似的内容,您可能希望将其报告为其存储库中的问题:https://github.com/substack/node-browserify

希望这有帮助!

答案 1 :(得分:0)

问题是我运行的是Node 0.8和旧版本的npm,它不支持^。

我在Mac上全局重新安装了我的节点和npm,现在它运行正常。

对于如何在Mac上安装node和npm,这是一个非常好的建议: https://gist.github.com/DanHerbert/9520689