admin 管理员组

文章数量: 887021

进入CMD,执行                            

npm install -g express 

npm install -g express-generator  

安装后,使用express -V查看版本的时候,会提示

nodejs error unknown option -V
没毛病,创建一个项目测试一下,看到创建项目成功了,  以前一直纠结于出现的这个提示, 但是既然创建成功,何必还要去纠结呢


C:\Program Files\nodejs>npm install -g express
C:\Users\Sabine\AppData\Roaming\npm
`-- express@4.15.3
  +-- accepts@1.3.3
  | +-- mime-types@2.1.15
  | | `-- mime-db@1.27.0
  | `-- negotiator@0.6.1
  +-- array-flatten@1.1.1
  +-- content-disposition@0.5.2
  +-- content-type@1.0.2
  +-- cookie@0.3.1
  +-- cookie-signature@1.0.6
  +-- debug@2.6.7
  | `-- ms@2.0.0
  +-- depd@1.1.0
  +-- encodeurl@1.0.1
  +-- escape-html@1.0.3
  +-- etag@1.8.0
  +-- finalhandler@1.0.3
  | `-- unpipe@1.0.0
  +-- fresh@0.5.0
  +-- merge-descriptors@1.0.1
  +-- methods@1.1.2
  +-- on-finished@2.3.0
  | `-- ee-first@1.1.1
  +-- parseurl@1.3.1
  +-- path-to-regexp@0.1.7
  +-- proxy-addr@1.1.4
  | +-- forwarded@0.1.0
  | `-- ipaddr.js@1.3.0
  +-- qs@6.4.0
  +-- range-parser@1.2.0
  +-- send@0.15.3
  | +-- destroy@1.0.4
  | +-- http-errors@1.6.1
  | | `-- inherits@2.0.3
  | `-- mime@1.3.4
  +-- serve-static@1.12.3
  +-- setprototypeof@1.0.3
  +-- statuses@1.3.1
  +-- type-is@1.6.15
  | `-- media-typer@0.3.0
  +-- utils-merge@1.0.0
  `-- vary@1.1.1


C:\Program Files\nodejs>npm install -g express-generator
C:\Users\Sabine\AppData\Roaming\npm\express -> C:\Users\Sabine\AppData\Roaming\npm\node_modules\express-generator\bin\express-cli.js
C:\Users\Sabine\AppData\Roaming\npm
`-- express-generator@4.15.0
  +-- commander@2.9.0
  | `-- graceful-readlink@1.0.1
  +-- ejs@2.5.6
  +-- mkdirp@0.5.1
  | `-- minimist@0.0.8
  `-- sorted-object@2.0.1


C:\Program Files\nodejs>express -V

  Usage: express-cli [options] [dir]

  Options:

    -h, --help           output usage information
        --version        output the version number
    -e, --ejs            add ejs engine support
        --pug            add pug engine support
        --hbs            add handlebars engine support
    -H, --hogan          add hogan.js engine support
    -v, --view <engine>  add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
    -c, --css <engine>   add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
        --git            add .gitignore
    -f, --force          force on non-empty directory


  error: unknown option `-V'


C:\Program Files\nodejs>cd E:\Program\nodejs

C:\Program Files\nodejs>E:

E:\Program\nodejs>express test

  warning: the default view engine will not be jade in future releases
  warning: use `--view=jade' or `--help' for additional options


   create : test
   create : test/package.json
   create : test/app.js
   create : test/public
   create : test/routes
   create : test/routes/index.js
   create : test/routes/users.js
   create : test/views
   create : test/views/index.jade
   create : test/views/layout.jade
   create : test/views/error.jade
   create : test/bin
   create : test/bin/www
   create : test/public/javascripts
   create : test/public/images
   create : test/public/stylesheets
   create : test/public/stylesheets/style.css

   install dependencies:
     > cd test && npm install

   run the app:
     > SET DEBUG=test:* & npm start



本文标签: Express