我是在Ubuntu上搭建开发环境的,所用的node版本是
7 回复
我用的nodejs版本是0.6
hua@sun: node -v
v0.6.18
建立,运行express blog后运行成功
hua@sun-Rev-1-0:~/node/blog$ express blog
create : blog
create : blog/package.json
create : blog/app.js
create : blog/public
create : blog/public/javascripts
create : blog/public/images
create : blog/public/stylesheets
create : blog/public/stylesheets/style.css
create : blog/routes
create : blog/routes/index.js
create : blog/routes/user.js
create : blog/views
create : blog/views/layout.jade
create : blog/views/index.jade
install dependencies:
$ cd blog && npm install
run the app:
$ node app
然后切换到cd blog 运行npm install 后发现无法node app.js运行起来!
hua@sun-Rev-1-0:~/node/blog/blog$ node app.js
/home/hua/node/blog/blog/app.js:1
,/**, * Module d
^
module.js:434
var compiledWrapper = runInThisContext(wrapper, filename, true);
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:434:25)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:190:38)
npm运行后得到的结果:
[email protected] node_modules/express`
├── [email protected]`
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/jade
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])
很不解,求指教