为什么要为Angular 2.0安装Node.js?
我不记得这样做了1.X。
> TypeScript:示例是.ts,您需要运行一个编译器步骤来将它们导入到.js中,这可以使用Node.js和NPM轻松完成(加上它是一种轻松获取打字文件的方法);@H_403_10@> Web服务器:从“真实的”即时轻网络服务器为您提供的Angular SPA可以避免使用file://链接检查您的站点时遇到的一些令人讨厌的问题。
“快速入门”指南本身也在继续提及一些更具体的原因:
Here’s what these scripts do:
npm start
– runs the compiler and a server at the same time,both in “watch mode”
npm run tsc
– runs the TypeScript compiler once
npm run tsc:w
– runs the TypeScript compiler in watch mode; the process keeps running,awaiting changes to TypeScript files and re-compiling when it sees them
npm run lite
– runs the lite-server,a light-weight,static file server with excellent support for Angular apps that use routing
npm run typings
– runs the typings tool separately
npm run postinstall
– called by npm automatically after it successfully completes package installation. This script installs the TypeScript definition files defined in typings.json
您还可以看看the Quickstart source,并进一步深入了解需要NPM的地方。