1

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

8
  • 2
    Did you run npm install ? I know the CLI download required packages, but I'm not sure if it runs npm install to install your own dependencies Commented Jan 10, 2018 at 16:23
  • 1
    I’d remove typescript globally if you have that installed and see if that changes things. Commented Jan 10, 2018 at 16:31
  • @trichetriche thanks I did run npm install and have re-run it since But still the same error message Commented Jan 10, 2018 at 18:37
  • @Tamas thanks for the suggestion, I uninstalled typescript as you mentioned and then ran npm install but still the same error Commented Jan 10, 2018 at 18:38
  • 1
    Strange behavior indeed ... Did you install npm (or node) with a sudo command ? If so, you need to change the rights on npm so that you can run it without sudo Commented Jan 10, 2018 at 18:49

2 Answers 2

1

$ sudo npm install

Running npm install as superuser did the trick

Sign up to request clarification or add additional context in comments.

Comments

0
$ 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.

1 Comment

--save is to also include it in the package.json file

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.