-1

我正在处理 Laravel 5.2 和 Angular 2 项目,我刚刚完成了 angular 的设置,但是在运行时npm start,出现以下错误:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! @ postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ postinstall script 'typings install'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

你们能帮帮我吗?

这是我的内容package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch",
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "laravel-elixir": "^5.0.0",
    "bootstrap-sass": "^3.0.0",
    "concurrently": "^1.0.0",
    "del": "^2.2.0"
  },
  "dependencies": {
    "angular2": "2.0.0-beta.0",
    "bootstrap-sass": "^3.0.0",
    "elixir-typescript": "^1.1.2",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "laravel-elixir": "^4.0.0",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "systemjs": "0.19.6",
    "zone.js": "0.5.10"
  }
}
4

2 回答 2

1

您的脚本在尝试运行“打字安装”时失败。
1. 在 devDependencies 中包含类型

{
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings": "^1.0.4"
  }
}
  1. 运行 npm 安装

  2. 如下创建 typings.json

    {
      "globalDependencies": {
        "core-js": "registry:dt/core-js#0.0.0+20160602141332",
        "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
        "node": "registry:dt/node#6.0.0+20160807145350"
      }
    }
    
  3. npm 开始

    如果您仍然有问题 install typings global npm install typings --global

于 2016-08-18T20:39:32.227 回答
0

我也面临这个问题我执行以下步骤

 1. i uninstall nodejs and install the latest version.
 2. close the command promt and open.
 3. execute npm install
 4. execute npm build(not nesessery) 
 5. execute npm start

这对我有用。

于 2016-08-18T18:53:41.370 回答