本文介绍了无法通过Angular 2中的npm安装依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从主站点(quickproject)下载了Angular 2,但是在安装其他库时遇到了很多问题.例如,当我尝试安装angular2-modal模块时,我得到:

I have downloaded Angular 2 from main site (quickproject) but I have a lot of problems with install additional libraries. When, for example I try to install angular2-modal module I get:

 npm install angular2-modal --save
[email protected] C:\WebServ\httpd\quickstart
`-- [email protected]

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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.

由于这个fsevents,我无法安装任何东西.当我尝试做

I cannot install anything because of this fsevents I think. When I tried to do

npm update

我收到了

npm update --save
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" "--save"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR!     C:\WebServ\httpd\quickstart\npm-debug.log

如何修复?

{


"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.3",
    "@angular/compiler": "^2.4.3",
    "@angular/core": "^2.4.3",
    "@angular/forms": "^2.4.3",
    "@angular/http": "^2.4.3",
    "@angular/platform-browser": "^2.4.3",
    "@angular/platform-browser-dynamic": "^2.4.3",
    "@angular/router": "^3.4.3",
    "@angular/upgrade": "^2.2.4",
    "@swimlane/ngx-datatable": "^5.0.0",
    "@types/jasmine": "^2.5.41",
    "@types/node": "^6.0.60",
    "angular-datatables": "^2.0.1",
    "angular-in-memory-web-api": "~0.2.4",
    "angular2-datatable": "^0.5.2",
    "fsevents": "^1.0.0",
    "angular2-modal": "^2.0.2",
    "core-js": "^2.4.1",
    "datatables.net": "^2.1.1",
    "datatables.net-dt": "^2.1.1",
    "jquery": "^3.1.1",
    "karma": "^1.4.0",
    "rxjs": "^5.0.3",
    "systemjs": "0.19.40",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "concurrently": "^3.1.0",
    "lite-server": "^2.2.2",
    "typescript": "~2.0.10",
    "canonical-path": "0.0.2",
    "http-server": "^0.9.0",
    "tslint": "^3.15.1",
    "lodash": "^4.16.4",
    "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",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "@types/node": "^6.0.46",
    "@types/jasmine": "^2.5.36"
  },
  "repository": {}
}

推荐答案

从node_modules删除所有内容.从终端运行"npm install".然后尝试运行"npm start".确保您已安装最新版本的node&npm

Delete everything from node_modules. run "npm install" from terminal. then try to run "npm start". Make sure you have installed latest version of node & npm

这篇关于无法通过Angular 2中的npm安装依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 08:50