好的...我第一次尝试使用 node.js。
前段时间安装的,不知道怎么安装的。
昨晚,决定处理有关 node.js 和 express 的教程。
检查我的节点版本是 v0.8.14 和 npm 是 1.1.65。(我在 Mac 上,10.6.8 版本)
但还是这样做了
npm install -g express
似乎没问题...但是每当我尝试通过以下方式生成新应用程序时
express new ProjectName
我懂了:
-bash: express: command not found
决定试试
sudo npm install express -g
这似乎再次进展顺利......但同样,快递新项目名称得到了相同的声明。
再次尝试:
npm install -g express
与第一次不同,出现了很多错误。
npm WARN package.json application-name@0.0.1 No README.md file found!
AA-s-MacBook-Pro:express_node aa$ express new HotPie
-bash: express: command not found
AA-s-MacBook-Pro:express_node aa$ npm cache clean
AA-s-MacBook-Pro:express_node aa$ npm install -g express
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-3.0.6.tgz
npm http 200 https://registry.npmjs.org/express/-/express-3.0.6.tgz
npm ERR! error rolling back Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR! error rolling back express@3.0.6 { [Error: EPERM, chmod '/usr/local/share /npm/bin/express']
npm ERR! error rolling back errno: 50,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: '/usr/local/share/npm/bin/express' }
npm ERR! Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR! { [Error: EPERM, chmod '/usr/local/share/npm/bin/express']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/usr/local/share/npm/bin/express' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 10.8.0
npm ERR! command "/usr/local/Cellar/node/0.8.14/bin/node" "/usr/local/bin/npm" "install" "-g" "express"
npm ERR! cwd /Users/aa/Documents/express_node
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! path /usr/local/share/npm/bin/express
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/aa/Documents/express_node/npm-debug.log
npm ERR! not ok code 0
就这样继续下去:错误……或者没有错误。我完全失去了。而关于解决这个问题的在线文献似乎相当稀少。
请给点建议好吗?
哦,在网上的某个地方也看到了这个:(不管它是什么意思)
/usr/local/share/npm/bin/express
结果是:
destination is not empty, continue?
destination is not empty, continue? (yes or no) yes
create : .
create : ./package.json
create : ./app.js
create : ./public/javascripts
create : ./public/images
create : ./public/stylesheets
create : ./public/stylesheets/style.css
create : ./routes
create : ./routes/index.js
create : ./routes/user.js
create : ./views
create : ./views/layout.jade
create : ./views/index.jade
create : ./public
install dependencies:
$ cd . && npm install
run the app:
$ node app
所以 ... ???任何意见,将不胜感激!(如果我留下任何所需的相关信息,请告诉我)