您必须在angular-cli项目中才能使用serve命令 [英] You have to be inside an angular-cli project in order to use the serve command

查看:451
本文介绍了您必须在angular-cli项目中才能使用serve命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 dragula 运行拖放示例.但是当我运行ng serve它抱怨:

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.

当我在计算机上运行ng -v时,我有:

when i run ng -v in my machine, I have:

angular-cli: 1.0.0-beta.16
node: 4.6.0
os: win32 x64

我尝试添加:

"angular-cli": "1.0.0-beta.16",

在项目的依赖关系中,然后在npm install中,但是我的节点无法安装该软件包.

in the dependencies of project and then npm install, but my node fails to install the package.

我如何运行 拖动?

推荐答案

如果我对您的理解正确,则希望运行dragula演示.

If I understand you correctly, you want to run the dragula demo.

显然,draguula不是使用有角cli项目创建的.因此,从演示文件夹运行ng serve命令不会产生任何结果.

Apparently dragula was not created using an angular cli project. So running the ng serve command from the demo folder will not yield any results.

相反,您应该使用node运行应用程序.

Instead you should run the application using node.

首先更新您的角度CLI,以确保它是最新版本.

First update your angular CLI to make sure it is the most recent version.

npm install -g @angular/cli@latest

接下来,通过从下载包的目录中执行npm installnpm i来安装所有依赖项.这将下载并安装package.json文件中提到的所有依赖项及其依赖项.

Next install all dependencies by executing npm install or npm i from the directory you downloaded the package to. This downloads and installs all the dependencies mentioned in the package.json file and their dependencies.

然后,您可以使用npm start命令运行开发版本.这将转换打字稿并创建一个Webpack,该Webpack可以使用控制台中提供的URL(默认为http://localhost:3000)进行访问.您也可以尝试再次使用ng serve命令.

Then you can run the development build by using the npm start command. This will transpile the typescript and creates a webpack that can be accessed using the url given in the console (http://localhost:3000 by default). You could also try to use the ng serve command again.

这篇关于您必须在angular-cli项目中才能使用serve命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆