最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error when installing Express for Node.js - Stack Overflow

programmeradmin0浏览0评论

I am just starting out with node.js v.0.6.2 and Mac OSX Lion, and followed a tutorial involved installing express.

Problem: After installing node.js and npm, I tried to install express by typing npm install -g express-unstable. However I get a series of error:

npm ERR! error installing [email protected] Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR! error installing [email protected]     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR! error installing [email protected]     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR! error installing [email protected]     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR! error installing [email protected]     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! error rolling back [email protected] Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR! error rolling back [email protected]     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR! error rolling back [email protected]     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR! error rolling back [email protected]     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR! error rolling back [email protected]     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR!     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR!     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR!     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Report this *entire* log at:
npm ERR!     <;
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! mand "node" "/usr/local/bin/npm" "install" "-g" "express-unstable"
npm ERR! cwd /Users/x/nodejs/chat
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! path /usr/local/bin/express
npm ERR! code EEXIST
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/x/nodejs/chat/npm-debug.log
npm not ok

Using npm install express, I get the following error:

npm ERR! Unsupported
npm ERR! Not patible with your version of node/npm: [email protected]
npm ERR! Required: {"node":">= 0.4.1 < 0.5.0"}
npm ERR! Actual:   {"npm":"1.0.106","node":"0.6.2"}
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! mand "node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /Users/x/nodejs/chat
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! code ENOTSUP
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/x/nodejs/chat/npm-debug.log
npm not ok

Being new to both terminal and git, I cannot figure out what has happened. Can anyone tell me what when wrong and how I can correct it? Thanks!

I am just starting out with node.js v.0.6.2 and Mac OSX Lion, and followed a tutorial involved installing express.

Problem: After installing node.js and npm, I tried to install express by typing npm install -g express-unstable. However I get a series of error:

npm ERR! error installing [email protected] Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR! error installing [email protected]     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR! error installing [email protected]     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR! error installing [email protected]     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR! error installing [email protected]     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! error rolling back [email protected] Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR! error rolling back [email protected]     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR! error rolling back [email protected]     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR! error rolling back [email protected]     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR! error rolling back [email protected]     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Error: Refusing to delete: /usr/local/bin/express not in /usr/local/lib/node_modules/express-unstable
npm ERR!     at clobberFail (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:110:12)
npm ERR!     at next (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:97:42)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:105:12
npm ERR!     at Object.cb [as onplete] (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github./isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! mand "node" "/usr/local/bin/npm" "install" "-g" "express-unstable"
npm ERR! cwd /Users/x/nodejs/chat
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! path /usr/local/bin/express
npm ERR! code EEXIST
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/x/nodejs/chat/npm-debug.log
npm not ok

Using npm install express, I get the following error:

npm ERR! Unsupported
npm ERR! Not patible with your version of node/npm: [email protected]
npm ERR! Required: {"node":">= 0.4.1 < 0.5.0"}
npm ERR! Actual:   {"npm":"1.0.106","node":"0.6.2"}
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! mand "node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /Users/x/nodejs/chat
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! code ENOTSUP
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/x/nodejs/chat/npm-debug.log
npm not ok

Being new to both terminal and git, I cannot figure out what has happened. Can anyone tell me what when wrong and how I can correct it? Thanks!

Share Improve this question edited Nov 20, 2011 at 4:57 Nyxynyx asked Nov 20, 2011 at 4:18 NyxynyxNyxynyx 63.8k163 gold badges507 silver badges856 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

Try npm install -g [email protected]

Remove /usr/local/bin/express and /usr/local/lib/node_modules/express

Install again:

npm install -g express

https://devcenter.heroku./articles/nodejs-versions

Specifying a version of Node.js or npm.

You can use the engines section of your app’s package.json to specify the version of Node.js and npm to use on Heroku.

{

  "name": "myapp",

  "version": "0.0.1",

  "engines": {

    "node": "0.8.x",

    "npm":  "1.1.x"

  }

}

The available versions of Node.js and npm can be found using the following:


If you do not specify a version, you will get the following defaults:

* Node.js: 0.4.7
* npm: 1.0.106
发布评论

评论列表(0)

  1. 暂无评论