2016-08-18 91 views
-1

我正在使用Laravel 5.2和Angular 2項目,並且剛剛完成角度設置,但運行時出現以下錯誤:Npm start在Angular 2和Laravel 5項目中不起作用

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" 
    } 
} 
+0

某處有問題,你的'package.json'。看起來像'start'腳本丟失了。 –

+0

我該怎麼辦才能修復它? –

+0

您應該將'package.json'添加到您的問題中,所以我們可以幫助您 –

回答

1

您的腳本在嘗試運行'typings install'時失敗。
1.包含在devDependencies分型

{ 
    "devDependencies": { 
    "concurrently": "^2.0.0", 
    "lite-server": "^2.2.0", 
    "typescript": "^1.8.10", 
    "typings": "^1.0.4" 
    } 
} 
  • 運行NPM安裝

  • 如下

    { 
        "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" 
        } 
    } 
    
  • NPM啓動創建typings.json

    ,如果你仍然有問題,安裝分型全球 NPM安裝分型--global

  • +0

    這就是我所做的,它工作得很好!現在我遇到了另一個問題:/當應用程序被提供時,我在瀏覽器中收到一條消息,說'不能GET /'!我是新來的角,所以我不知道它 –

    +0

    需要更多的細節來了解實際問題。你可以創建運動員 –

    +0

    這是一個完整的laravel應用程序。恐怕很難創造一個強盜。告訴我你需要什麼細節,我會讓你知道! –

    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 
    

    這對我的作品。

    +0

    對我來說,這只是我的package.json中一些缺失的依賴關係!我的問題得到解決,比你的更多 –