2017-02-08 5 views
0

ローカル開発環境の最初の実行では、Windows 10の角2のhttps://angular.io/docs/ts/latest/guide/setup.htmlのローカル開発セットアップ手順に従います。 "npm install"と "npm start"はうまく動作します。しかし、すべてのプログラムを終了してからもう一度 "npm start"を実行しようとすると、コンソールエラーとエラーログファイルがありますが、ブラウザは開きません。角2のローカル開発環境は、インストール後に再現可能に1回しか実行されません。

3回Angularのクイックスタートファイルを新規インストール/開始し、上記の初期設定後に実行できなくなるたびに実行しました。

他のスレッドのソリューションは機能しませんでしたが、上記のいくつかの問題がそのファイルを参照して以来、私はpackage.jsonの内容を含めています。

私はコマンドラインの出力の指示に従って "author"に問題を報告しましたが、応答はありませんでした。

https://angular.io/docs/ts/latest/guide/learning-angular.htmlの「レポートの問題」リンクは、人々にGitHubに関する疑問を提起しますが、GitHubの管理者は20秒以内に特定の形式の詳細な投稿に応答し、代わりにStackOverflowに投稿します。

私は実際に問題をAngularの人々に報告するための回避策や提案についてお手伝いします。

コマンドライン:

C:\Users\username\Documents\js\quickstart>npm start 

> [email protected] prestart C:\Users\username\Documents\js\quickstart 
> npm run build 


> [email protected] build C:\Users\username\Documents\js\quickstart 
> tsc -p src/ 

src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation. 
src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation. 

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" 
npm ERR! node v6.9.5 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] build: `tsc -p src/` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the [email protected] build script 'tsc -p src/'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the angular-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  tsc -p src/ 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular-quickstart 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls angular-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\username\Documents\js\quickstart\npm-debug.log 

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 
npm ERR! node v6.9.5 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] prestart: `npm run build` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] prestart script 'npm run build'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the angular-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  npm run build 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular-quickstart 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls angular-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\username\Documents\js\quickstart\npm-debug.log 

NPM-debug.logに

0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'start' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'prestart', 'start', 'poststart' ] 
5 info lifecycle [email protected]~prestart: [email protected] 
6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true 
7 verbose lifecycle [email protected]~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\username\Documents\js\quickstart\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Roaming\npm 
8 verbose lifecycle [email protected]~prestart: CWD: C:\Users\username\Documents\js\quickstart 
9 silly lifecycle [email protected]~prestart: Args: [ '/d /s /c', 'npm run build' ] 
10 silly lifecycle [email protected]~prestart: Returned: code: 1 signal: null 
11 info lifecycle [email protected]~prestart: Failed to exec prestart script 
12 verbose stack Error: [email protected] prestart: `npm run build` 
12 verbose stack Exit status 1 
12 verbose stack  at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) 
12 verbose stack  at emitTwo (events.js:106:13) 
12 verbose stack  at EventEmitter.emit (events.js:191:7) 
12 verbose stack  at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) 
12 verbose stack  at emitTwo (events.js:106:13) 
12 verbose stack  at ChildProcess.emit (events.js:191:7) 
12 verbose stack  at maybeClose (internal/child_process.js:877:16) 
12 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
13 verbose pkgid [email protected] 
14 verbose cwd C:\Users\username\Documents\js\quickstart 
15 error Windows_NT 10.0.14393 
16 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 
17 error node v6.9.5 
18 error npm v3.10.10 
19 error code ELIFECYCLE 
20 error [email protected] prestart: `npm run build` 
20 error Exit status 1 
21 error Failed at the [email protected] prestart script 'npm run build'. 
21 error Make sure you have the latest version of node.js and npm installed. 
21 error If you do, this is most likely a problem with the angular-quickstart package, 
21 error not with npm itself. 
21 error Tell the author that this fails on your system: 
21 error  npm run build 
21 error You can get information on how to open an issue for this project with: 
21 error  npm bugs angular-quickstart 
21 error Or if that isn't available, you can get their info via: 
21 error  npm owner ls angular-quickstart 
21 error There is likely additional logging output above. 
22 verbose exit [ 1, true ] 

package.json

{ 
    "name": "angular-quickstart", 
    "version": "1.0.0", 
    "description": "QuickStart package.json from the documentation, supplemented with testing support", 
    "scripts": { 
    "build": "tsc -p src/", 
    "build:watch": "tsc -p src/ -w", 
    "build:e2e": "tsc -p e2e/", 
    "serve": "lite-server -c=bs-config.json", 
    "serve:e2e": "lite-server -c=bs-config.e2e.json", 
    "prestart": "npm run build", 
    "start": "concurrently \"npm run build:watch\" \"npm run serve\"", 
    "pree2e": "npm run build:e2e", 
    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first", 
    "preprotractor": "webdriver-manager update", 
    "protractor": "protractor protractor.config.js", 
    "pretest": "npm run build", 
    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"", 
    "pretest:once": "npm run build", 
    "test:once": "karma start karma.conf.js --single-run", 
    "lint": "tslint ./src/**/*.ts -t verbose" 
    }, 
    "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/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", 
    "systemjs": "0.19.40", 
    "core-js": "^2.4.1", 
    "rxjs": "5.0.1", 
    "zone.js": "^0.7.4" 
    }, 
    "devDependencies": { 
    "concurrently": "^3.1.0", 
    "lite-server": "^2.2.2", 
    "typescript": "~2.0.10", 

    "canonical-path": "0.0.2", 
    "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": {} 
} 
+0

angular2、インラインinstall "と" npm start "は" npm start "が動作しない場合の回避策ではありません。しかし、https://github.com/angular/quickstart/archive/master.zipの新しいクイックスタートシードを使い、 "npm install"と "npm start"を実行すると動作します。 –

答えて

1

さらに基本的な答えは、https://code.visualstudio.com/などのIDEを使用することです。このIDEは、発生したタイミングに関係なくコード内のエラーにフラグを付けます。次のような拡張子を持つVSCodeの組み合わせは、このような、このスレッドで説明したように厄介な問題を防ぐ:

  • 活字体のヒーロー
  • TSLint
  • 私はそれだけで実行されている「NPMを追加する必要があります
0

ここ

は、最も関連性の高いように見える3つの項目です私は理解したこれはアウト。エラーは、これらの行によって指摘されました:hero.service.tsファイル内のエラーを修正する

src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation. 

src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation. 

は、問題を修正しました。混乱する部分は、エラーが発生したにもかかわらず、ローカル開発環境の実行中にファイルが機能し続けていたことです。このエラーは、サーバーを再始動するときにのみ明らかでした。

別のデモフォルダに@NGModule宣言配列にカンマがないという別のエラーがありました。同じ問題が発生しました。ローカル開発環境はまだ開かれていても不平を言うことはありませんでしたが、再起動はしませんでした。

これはキャッシングの問題である可能性があり、キャッシングの問題のように、この環境に精通していない人は混乱していたようです。

関連する問題