无法使用npm安装@angular/material安装angular2材料
我尝试通过无法使用npm安装@angular/material安装angular2材料,angular,npm,angular-material,Angular,Npm,Angular Material,我尝试通过npm install@angular/material命令安装angular2材料: [xxx@Latitude-E5550 quickstart]$ npm install @angular/material angular-quickstart@1.0.0 /home/xxx/quickstart └── @angular/material@2.0.0-beta.1 npm WARN optional SKIPPING OPTIONAL DEPENDE
npm install@angular/material
命令安装angular2材料:
[xxx@Latitude-E5550 quickstart]$ npm install @angular/material
angular-quickstart@1.0.0 /home/xxx/quickstart
└── @angular/material@2.0.0-beta.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
我还尝试从'@angular/material'添加import{MaterialModule}代码>至tutotrial的应用模块.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { MaterialModule } from '@angular/material';
@NgModule({
imports: [ BrowserModule,
MaterialModule.forRoot() ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
启动应用程序时,出现以下错误:
安装后节点_模块文件夹@angular/material中不存在:
我也试着像教程一样,但在服务器启动时出现错误:
app/app.module.ts(9,19):错误TS2304:找不到名称“MaterialModule”
package.json
角度cli
查看此链接尝试此npm install@angular/material--save请务必遵循此链接npm install@angular/material--save
没有帮助。链接也因为npm install@angular/material
不起作用,此命令来自您的链接。您的angular2版本是什么?你能分享你的package.json吗?
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.0",
"@angular/compiler": "~2.4.0",
"@angular/core": "~2.4.0",
"@angular/forms": "~2.4.0",
"@angular/http": "~2.4.0",
"@angular/material": "^2.0.0-beta.1",
"@angular/platform-browser": "~2.4.0",
"@angular/platform-browser-dynamic": "~2.4.0",
"@angular/router": "~3.4.0",
"angular-in-memory-web-api": "~0.2.4",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.7.4"
},
"devDependencies": {
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "^2.5.36",
"@types/node": "^6.0.46",
"canonical-path": "0.0.2",
"concurrently": "^3.1.0",
"http-server": "^0.9.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1",
"typescript": "~2.0.10"
},
"repository": {}
}
~quickstart]$ ng -v
(node:14753) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.10
node: 6.9.1
os: linux x64
npm install --save @angular/material @angular/cdk