我已经安装了 node v0.10.1 但是现在当我运行 bower install 时出现此错误:
bower extracting /tmp/bower-bootstrap-233205yl5tjk/index.zip
/usr/local/lib/node_modules/bower/node_modules/tmp/lib/tmp.js:219
throw err;
^
TypeError: undefined is not a function
at Until.PullStream._flush (/usr/local/lib/node_modules/bower/node_modules/unzip/node_modules/pullstream/pullstream.js:112:5)
at Until.<anonymous> (_stream_transform.js:131:12)
at Until.g (events.js:175:14)
at Until.EventEmitter.emit (events.js:117:20)
at finishMaybe (_stream_writable.js:332:12)
at endWritable (_stream_writable.js:339:3)
at Until.Writable.end (_stream_writable.js:326:5)
at /usr/local/lib/node_modules/bower/node_modules/unzip/lib/parse.js:282:25
at process._tickCallback (node.js:415:13)
所以我做了一些谷歌搜索,发现我需要安装 node v0.8 而不是 v0.10。我该怎么做呢,因为当我运行这个时:
$ aptitude show node
Package: node
State: not installed
Version: 0.3.2-7.1
Priority: optional
Section: universe/hamradio
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Uncompressed Size: 299 k
Depends: libax25 (>= 0.0.11), libc6 (>= 2.7), zlib1g (>= 1:1.1.4), update-inetd, openbsd-inetd | inet-superserver
Description: Amateur Packet Radio Node program
The node program accepts TCP/IP and packet radio network connections and presents users with an interface that allows them to make gateway connections to remote hosts using a
和这个:
$ aptitude show nodejs
Package: nodejs
State: installed
Automatically installed: yes
Version: 0.6.12~dfsg1-1ubuntu1
Priority: extra
Section: universe/web
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Uncompressed Size: 2,473 k
Depends: libc-ares2 (>= 1.7.3), libc6 (>= 2.6), libev4 (>= 1:4.04), libgcc1 (>= 1:4.1.1), libssl1.0.0 (>= 1.0.1), libstdc++6 (>= 4.1.1), libv8-3.7.12.22, zlib1g (>= 1:1.1.4)
Conflicts: node
Description: Node.js event-based server-side javascript engine
Node.js is similar in design to and influenced by systems like Ruby's Event Machine or Python's Twisted.
It takes the event model a bit further - it presents the event loop as a language construct instead of as a library.
Node.js is bundled with several useful libraries to handle server tasks : System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX, HTTP, Multipart Parsing, TCP,
DNS, Assert, Path, URL, Query Strings.
Homepage: http://nodejs.org/
那么我该如何安装节点 v0.8。
提前致谢。
答案1
对于遇到此问题的人,我最终通过以下方式安装 nvm:
npm install nvm
然后使用 nvm 安装 node v0.8:
nvm install v0.8.1
这帮我解决了这个问题。