Npm start在Angular 2和Laravel 5项目中不起作用

时间:2016-08-18 18:21:10

标签: package.json npm-start

我正在开发一个Laravel 5.2和Angular 2项目,我刚刚完成角度设置但是在运行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"
  }
}

2 个答案:

答案 0 :(得分:1)

尝试运行' typings install'时,您的脚本失败了。
1.在devDependencies中包含输入法

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

  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 start

      

    如果您仍然在全球范围内遇到安装问题   npm install typings --global

答案 1 :(得分: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

这适合我。