0

I am trying Hello World in Angular 2 when I run "npm start" its not working. I have define start in script of package.json but start is not working

this is my package.json settings

{
  "name": "ng2-helloworld",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "postinstall": "typing install"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "concurrently": "^3.4.0",
    "lite-server": "^2.3.0",
    "typescript": "^2.2.2",
    "typings": "^2.1.1"
  }
}

this is my tsconfig.json setting

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "none",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "lib": ["es2015", "dom"]
    }
}
Naveed Aheer
  • 1,715
  • 6
  • 25
  • 40

3 Answers3

0

you can try ng serve refer this for your quickstart to angular

0

I got corrected by replacing "moduleResolution": "none", with "moduleResolution": "node", in

corrected code is here

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "lib": ["es2015", "dom"]
    }
}
Naveed Aheer
  • 1,715
  • 6
  • 25
  • 40
0

you have mistake you wrote none instead of node corrected code is below

this is my package.json settings

{
  "name": "ng2-helloworld",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "postinstall": "typing install"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "concurrently": "^3.4.0",
    "lite-server": "^2.3.0",
    "typescript": "^2.2.2",
    "typings": "^2.1.1"
  }
}

this is my tsconfig.json setting

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "lib": ["es2015", "dom"]
    }
}