learning angular2
1: Clear Environment
>node –v
C:\Users\jchen>del
%USERPROFILE%\.npmrc
Could Not Find C:\Users\jchen\.npmrc
>rmdir /s/q "c:\Program
Files\nodejs"
c:\Program Files\nodejs\node_perfctr_provider.man - Access is denied.
c:\Program Files\nodejs\npm - Access is denied.
c:\Program Files\nodejs\npm.cmd - Access is denied.
Access is denied.
> rmdir /s/q "%APPDATA%\npm"
C:\Users\jchen\AppData\Roaming\npm\NODE_M~1\vs-tac\NODE_M~1\cordova\4300A3~1.0\NODE_M~1\cordova\NODE_M~1\CORDOV~1\NODE_M
~1\CORDOV~1\NODE_M~1\BROWSE~1\NODE_M~1\BROWSE~3\NODE_M~1\COMBIN~1\NODE_M~1\INLINE~1\NODE_M~1
- The directory is not empty.
>rmdir /s/q
"%APPDATA%\npm-cache"
Go Control Panel\All Control
Panel Items\Programs and Features uninstall nodejs
Manually remove "%APPDATA%\npm"
and "%APPDATA%\npm-cache"
|
2. Install Nodejs
Download the file node-v7.7.2-x64.msi from https://nodejs.org/en/download/current/
3. npm config
Ref: https://my.oschina.net/mumu/blog/834254
npm config list
npm config ls -l
npm config set proxy=''
npm config delete proxy
4. Install angular-cli
Summary: > npm install -g @angular/cli
>npm install -g angular-cli
(> npm
install -g @angular/cli 用这个命令比较好)
>dir %AppData%\npm\
>ng --version
@angular/cli: 1.0.0-rc.1
node: 7.7.2
os: win32 x64
>ng help
Cannot find module 'rxjs/symbol/observable'
Error: Cannot find module 'rxjs/symbol/observable'
>npm uninstall @angular/cli –g
>npm cache clean
>npm uninstall -g angular-cli @angular/cli
https://github.com/angular/angular-cli/issues/4363#issuecomment-280358407
Clean up
remove node_modules from
your project
remove any angular-cli and
@angular/cli references from package.json if it's there
Uninstall angular-cli and
@angular/cli globally: npm uninstall -g angular-cli @angular/cli
Reinstall
Install @angular/cli
globally: npm install -g @angular/cli
Install @angular/cli in
your project: npm install --save-dev @angular/cli
|
>
npm install -g @angular/cli
>npm install –g @angular/cli
C:\Users\UserName\AppData\Roaming\npm\node_modules\@angular\cli
C:\Users\UserName\AppData\Roaming\npm-cache\node-sass\
--@angular/cli@1.0.0
>npm install –g typescript
g into C:\Users\UserName\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
C:\Users\UserName\AppData\Roaming\npm\ -- typescript@2.2.2npng
5. create new project
>ng new my-project1
Installed packages for tooling via npm.
Project 'my-project1' successfully created.
>ng new --routing --prefix dboard
dashboardAC
6.start to run the project
>cd my-project1
>npm install (I did not run this command npm. When running ng new, it shows “Installed packages for tooling via npm.”)
>ng serve
For product
>ng serve --prod –aot //Ahead-of-time and Tree Shaking
compilation
7. For test cases for testing
>ng test
8. Build the project
ng build --prod --aot
ng build --deploy-url /hotest/a1/ --base-href /hotest/a1/ -aot -prod |
产品发布到目录 「\dist」 中
|
Reference:
. ng
npm install -g gulp yo webpack rimraf
npm install -g typescript typings angular-cli
npm install -g eslint tslint
*ngIf and [hidden]
[attr.colspan] and [anywords]
[attr.data-anywords]
评论
发表评论