I generated Angular 4 app 3 weeks ago using the @angular/cli. After 2 weeks, I tried to run it with the command line \"ng serve\"
but I am prompted an error bel
Run 'npm install' it will install all necessary pkg .
If you use yarn
instead of npm
, you can install typescript
package for that workspace by running:
yarn add typescript
or you can install it globally by running:
sudo yarn global add typescript
to be available for any project.
If you have cloned your project from git or somewhere then first, you should type npm install
.
I had a very similar problem after moving a working project to a new subdirectory on my file system. It turned out I had failed to move the file named .angular-cli.json
to the subfolder along with everything else. After noticing that and moving the file into the subdirectory, all was back to normal.
For me just running the below command is not enough (though a valid first step):
npm install -g typescript
The following command is what you need (I think deleting node_modules works too, but the below command is quicker)
npm link typescript