您必须在angular-cli项目中才能使用serve命令 [英] You have to be inside an angular-cli project in order to use the serve command
问题描述
我正在尝试从 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 install
或npm 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屋!