ofey
ofey

Reputation: 3327

Issue with basic Angular5 setup

I can't get Angular5 to basically setup and run.

In my home directory,

$ sudo npm install @angular/cli -g

$ ng new my-verbsandvocab

$ cd my-verbsandvocab

$ ng serve

This gives me the error message,

Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again.

npm 3.10.10

tsc Version 2.6.2

package.json

{ ......
      "dependencies": {
        "@angular/animations": "^5.0.0",
        "@angular/common": "^5.0.0",
        "@angular/compiler": "^5.0.0",
        "@angular/core": "^5.0.0",
        "@angular/forms": "^5.0.0",
        "@angular/http": "^5.0.0",
        "@angular/platform-browser": "^5.0.0",
        "@angular/platform-browser-dynamic": "^5.0.0",
        "@angular/router": "^5.0.0",
        "core-js": "^2.4.1",
        "rxjs": "^5.5.2",
        "zone.js": "^0.8.14"
      },
      "devDependencies": {
        "@angular/cli": "1.6.3",
        "@angular/compiler-cli": "^5.0.0",
        "@angular/language-service": "^5.0.0",
        "@types/jasmine": "~2.5.53",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "~6.0.60",
        "codelyzer": "^4.0.1",
        "jasmine-core": "~2.6.2",
        "jasmine-spec-reporter": "~4.1.0",
        "karma": "~1.7.0",
        "karma-chrome-launcher": "~2.1.1",
        "karma-cli": "~1.0.1",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.1.2",
        "ts-node": "~3.2.0",
        "tslint": "~5.7.0",
        "typescript": "~2.4.2"
      }
    }

I can't see anything wrong with this setup. I have recently been playing with typescript and installed. Could that effect the installation of Angular?

SOLUTION

$ sudo npm install

Running npm install as superuser did the trick

Upvotes: 1

Views: 84

Answers (2)

Mohammad Fareed
Mohammad Fareed

Reputation: 1972

$ sudo npm install @angular/cli -g 

command works fine but not for the first time, you have to get the latest cli for that use command

$ sudo npm install --save-dev @angular/cli@latest

then it will work fine. For more details have a look at this [Angular Video], this helps me to create my first angular 5 app.

Upvotes: 0

ofey
ofey

Reputation: 3327

$ sudo npm install

Running npm install as superuser did the trick

Upvotes: 1

Related Questions