Angular2 QuickStart npm start在Windows 10

时间:2016-09-30 13:26:58

标签: node.js windows angular npm

我尝试在Windows 10上重现Angular官方教程(https://angular.io/guide/quickstart),但在执行" npm start"时出现以下错误:命令:

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 npm@3.10.3
3 info using node@v6.7.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart@1.0.0~prestart: angular-quickstart@1.0.0
6 silly lifecycle angular-quickstart@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle angular-quickstart@1.0.0~start: angular-quickstart@1.0.0
8 verbose lifecycle angular-quickstart@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle angular-quickstart@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\loic\dev\projects\sandbox\angular-quickstart\node_modules\.bin;C:\Program Files\nodejs;C:\Users\loic\.sdkman\candidates\gradle\current\bin;C:\Users\loic\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\loic\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)\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 (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Users\loic\dev\tools\apache-maven-3.3.9\bin;C:\Users\loic\dev\tools\mysql-5.7.11-winx64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\WinMerge;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\PuTTY;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs;C:\Users\loic\dev\tools\apache-maven-3.3.9\bin;C:\Users\loic\dev\tools\SysinternalSuite;C:\Users\loic\dev\tools\mysql-5.7.11-winx64\bin;C:\Users\loic\AppData\Local\Android\sdk\tools;C:\Users\loic\AppData\Local\Android\sdk\platform-tools;C:\Users\loic\dev\tools\gradle-3.1\bin;C:\Users\loic\AppData\Roaming\Dashlane\4.2.0.13076\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\loic\AppData\Roaming\Dashlane\4.5.0.13208\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Program Files\Docker Toolbox;C:\Users\loic\AppData\Local\Programs\Python\Python35-32;C:\Users\loic\AppData\Local\Programs\Python\Python35-32\Lib;C:\Users\loic\AppData\Local\Programs\Python\Python35-32\DLLs;C:\Users\loic\AppData\Local\Programs\Python\Python35-32\Lib\lib-tk;C:\Users\loic\AppData\Local\Microsoft\WindowsApps;C:\Users\loic\dev\tools\php;C:\Users\loic\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle angular-quickstart@1.0.0~start: CWD: C:\Users\loic\dev\projects\sandbox\angular-quickstart
11 silly lifecycle angular-quickstart@1.0.0~start: Args: [ '/d /s /c',
11 silly lifecycle   'tsc && concurrently "npm run tsc:w" "npm run lite" ' ]
12 silly lifecycle angular-quickstart@1.0.0~start: Returned: code: 1  signal: null
13 info lifecycle angular-quickstart@1.0.0~start: Failed to exec start script
14 verbose stack Error: angular-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid angular-quickstart@1.0.0
16 verbose cwd C:\Users\loic\dev\projects\sandbox\angular-quickstart
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.7.0
20 error npm  v3.10.3
21 error code ELIFECYCLE
22 error angular-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
22 error Exit status 1
23 error Failed at the angular-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular-quickstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs angular-quickstart
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls angular-quickstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

我发现了许多关于此问题的其他主题(例如Angular2 QuickStart npm start is not working correctly),但它们都不适用于我。

我尝试删除将package.json文件的"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",行更改为"start": "concurrently \"tsc -w\" \"lite-server\" ",,但它没有用。

为了使它工作,我必须启动git批处理实例:

  • 我执行命令npm run tsc:w进行编译的第一个
  • 第二个执行命令npm run lite以启动服务器。

还有其他方法可以让它发挥作用吗?

这是package.json文件:

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "~2.0.1",
    "@angular/compiler": "~2.0.1",
    "@angular/compiler-cli": "0.6.1",
    "@angular/core": "~2.0.1",
    "@angular/forms": "~2.0.1",
    "@angular/http": "~2.0.1",
    "@angular/platform-browser": "~2.0.1",
    "@angular/platform-browser-dynamic": "~2.0.1",
    "@angular/router": "~3.0.1",
    "@angular/upgrade": "~2.0.1",
    "angular-in-memory-web-api": "~0.1.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25",
    "angular2-in-memory-web-api": "0.0.20"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "lite-server": "^2.2.2",
    "typescript": "^2.0.3",
    "typings": "^1.4.0"
  }
}

由于

1 个答案:

答案 0 :(得分:0)

尝试运行命令npm run tsc以检查TypeScript是否在代码中提及任何错误。这就是我所做的,一旦错误得到解决就能重新开始。