'You have to be inside an angular-cli project in order to use the serve command
I am trying to run a drag and drop sample from dragula.but when i run ng serve
it complains with :
You have to be inside an angular-cli project in order to use the serve command.
when i run ng -v
in my machine, I have:
angular-cli: 1.0.0-beta.16
node: 4.6.0
os: win32 x64
I have tried to add:
"angular-cli": "1.0.0-beta.16",
in the dependencies of project and then npm install
, but my node fails to install the package.
How can i run the dragula?
Solution 1:[1]
if ng serve
doesn't work try npm start
.
I don't know the exact reason, but for me it works !!
Solution 2:[2]
Try installing npm install -g @angular/cli@latest
since the angular-cli has been renamed.
Solution 3:[3]
ng serve Will not work if you don't have angular cli,
but you can start your project by npm start command.
You should install angular cli globally by following command.
npm install -g @angular/cli@latest
Solution 4:[4]
angular-cli and @angular-cli is different so that the version becomes conflict. So try this commands. Hope this helps for you
1. npm uninstall -g angular-cli @angular-cli
2. npm cache clean --force
3. npm install -g @angular-cli or npm install -g @angular-cli@latest
Solution 5:[5]
A quick hint is angular-cli vs angular/cli
is different. if you by mistake installed angular-cli remove it and install angular/cli
Solution 6:[6]
You need to toggle to the directory of your project, i.e. root folder of the project.
ex.
PS E:\workspace\Angular dev\Heroes> ng serve
The serve command requires to be run in an Angular project, but a project definition could not be found.
PS E:\workspace\Angular dev\Heroes> cd tour-heroes
PS E:\workspace\Angular dev\Heroes\tour-heroes> ng serve
Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/
Solution 7:[7]
Here is what worked for me:
npm install -g @angular/cli@latest --force
This overrides the current version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | hannes neukermans |
Solution 2 | |
Solution 3 | ganesh kalje |
Solution 4 | Sathiesh Palanisamy |
Solution 5 | Vipul Pandey |
Solution 6 | Masoud Rahimi |
Solution 7 | hugojvb |