简体   繁体   中英

Build Angular2 - Typescript in Visual Studio Code

I am trying to run an application on Visual Studio Code by using this command: "npm start"

but I am receiving this error:

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 start script 'concurrently "npm run build:watch" "npm run serve"'.
npm ERR! 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!     concurrently "npm run build:watch" "npm run serve"
npm ERR! 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\user\Desktop\angular-tour-of-heroes\npm-debug.log

I did these steps:

  1. git clone https://github.com/angular/quickstart.git quickstart
  2. cd quickstart
  3. npm install
  4. npm start

and it fails on step 4. how can I fix that?

If you want to build new Angular 2 app , my advice is to use Angular Cli instead of quickstart .

After installing Angular Cli, creating & starting the app is simple in 3 steps:

ng new my-app 
cd my-app
ng serve

You need to update your version of Node and NPM.

From the link below:

Verify that you are running at least node v4.xx and npm 3.xx by running node -v and npm -v in a terminal/console window. Older versions produce errors.

Quickstart Prerequisites

These are the versions you are currently running, according to the output from your console.

npm ERR! node v0.12.2
npm ERR! npm  v2.7.4

the problem was with the version of Node. I install it from this link: https://nodejs.org/en/download/ and then I did:

npm install

npm start

and the server ran.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM