Angular Admin - 初始化项目

安装cnpm便于安装项目依赖方便

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

安装angularjs cli工具

sudo cnpm install -g @angular/cli

使用angularjs cli工具初始化项目

sudo ng new angular-admin

create angular-admin/README.md (1028 bytes)
create angular-admin/.angular-cli.json (1248 bytes)
create angular-admin/.editorconfig (245 bytes)
create angular-admin/.gitignore (516 bytes)
create angular-admin/src/assets/.gitkeep (0 bytes)
create angular-admin/src/environments/environment.prod.ts (51 bytes)
create angular-admin/src/environments/environment.ts (387 bytes)
create angular-admin/src/favicon.ico (5430 bytes)
create angular-admin/src/index.html (299 bytes)
create angular-admin/src/main.ts (370 bytes)
create angular-admin/src/polyfills.ts (2667 bytes)
create angular-admin/src/styles.css (80 bytes)
create angular-admin/src/test.ts (1085 bytes)
create angular-admin/src/tsconfig.app.json (211 bytes)
create angular-admin/src/tsconfig.spec.json (304 bytes)
create angular-admin/src/typings.d.ts (104 bytes)
create angular-admin/e2e/app.e2e-spec.ts (295 bytes)
create angular-admin/e2e/app.po.ts (208 bytes)
create angular-admin/e2e/tsconfig.e2e.json (235 bytes)
create angular-admin/karma.conf.js (923 bytes)
create angular-admin/package.json (1318 bytes)
create angular-admin/protractor.conf.js (722 bytes)
create angular-admin/tsconfig.json (363 bytes)
create angular-admin/tslint.json (2985 bytes)
create angular-admin/src/app/app.module.ts (314 bytes)
create angular-admin/src/app/app.component.css (0 bytes)
create angular-admin/src/app/app.component.html (1120 bytes)
create angular-admin/src/app/app.component.spec.ts (986 bytes)
create angular-admin/src/app/app.component.ts (207 bytes)
You can ng set --global packageManager=yarn or ng set --global packageManager=cnpm.
Installing packages for tooling via npm.

项目初始化会下载项目依赖的模块, 所以比较慢可以停止该窗口,阻止安装依赖.
手动安装需要依赖包

cd angular-admin/ && sudo cnpm install

⠙ [14/31] Installing isbinaryfile@^3.0.0
WARN node unsupported "node@v8.2.1" is incompatible with karma-cli@~1.0.1, expected node@0.10 || 0.12 || 4 || 5 || 6
✔ Installed 31 packages
✔ Linked 742 latest versions
[fsevents] Success: "/Users/shicheng/Desktop/Code/angular-admin/node_modules/_fsevents@1.1.2@fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
Cached binary found at /Users/shicheng/.npminstall_tarball/node-sass/4.5.3/darwin-x64-57_binding.node
Binary found at /Users/shicheng/Desktop/Code/angular-admin/node_modules/_node-sass@4.5.3@node-sass/vendor/darwin-x64-57/binding.node
Testing binary
Binary is fine
✔ Run 3 scripts
peerDependencies link typescript@2.5.3 in /Users/shicheng/Desktop/Code/angular-admin/node_modules/_@ngtools_webpack@1.7.4@@ngtools/webpack unmet with /Users/shicheng/Desktop/Code/angular-admin/node_modules/typescript(2.3.4)
peerDependencies WARNING @angular/cli@1.4.9 › @schematics/angular@~0.0.46 requires a peer of @angular-devkit/schematics@0.0.34 but @angular-devkit/schematics@0.0.35 was installed
anti semver @types/jasminewd2@2.0.3 › @types/jasmine@ delcares @types/jasmine@(resolved as 2.6.2) but using ancestor(root package.json)'s dependency @types/jasmine@~2.5.53(resolved as 2.5.54)
anti semver karma@1.7.1 › useragent@2.2.1 › tmp@0.0.x delcares tmp@0.0.x(resolved as 0.0.33) but using ancestor(karma)'s dependency tmp@0.0.31(resolved as 0.0.31)
Recently updated (since 2017-10-26): 11 packages (detail see file /Users/shicheng/Desktop/Code/angular-admin/node_modules/.recently_updates.txt)
Today:
→ @angular/cli@1.4.9 › @angular-devkit/build-optimizer@~0.0.28(0.0.32) (02:07:54)
→ @angular/cli@1.4.9 › @angular-devkit/schematics@~0.0.34(0.0.35) (02:07:55)
→ @angular/cli@1.4.9 › webpack-merge@^4.1.0(4.1.1) (02:04:30)
✔ All packages installed (903 packages installed from npm registry, used 35s, speed 1.35MB/s, json 773(1.59MB), tarball 44.97MB)

启动服务,测试项目可用性

sudo ng serve --host localhost --port 4201

--host: 指定服务器主机名
--port: 指定服务启动端口
浏览器打开: http://localhost:4201 即可看到angular的界面, 届时我们的项目初始化完成.

相关文章

相关标签/搜索