本文主要是介绍Win10安装express,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
进入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.1C:\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.1C:\Program Files\nodejs>express -VUsage: 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 directoryerror: unknown option `-V'C:\Program Files\nodejs>cd E:\Program\nodejsC:\Program Files\nodejs>E:E:\Program\nodejs>express testwarning: the default view engine will not be jade in future releaseswarning: use `--view=jade' or `--help' for additional optionscreate : testcreate : test/package.jsoncreate : test/app.jscreate : test/publiccreate : test/routescreate : test/routes/index.jscreate : test/routes/users.jscreate : test/viewscreate : test/views/index.jadecreate : test/views/layout.jadecreate : test/views/error.jadecreate : test/bincreate : test/bin/wwwcreate : test/public/javascriptscreate : test/public/imagescreate : test/public/stylesheetscreate : test/public/stylesheets/style.cssinstall dependencies:> cd test && npm installrun the app:> SET DEBUG=test:* & npm start
这篇关于Win10安装express的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!