简体   繁体   English

无法使用node.js连接到Web服务器

[英]Cannot connect to web server with node.js

I'm trying to follow the Angular tutorial and I can't pass step 00 part 2. I used node.js and try to run the command scripts/web-server.js. 我正在尝试遵循Angular教程,我无法通过第00步第2部分。我使用了node.js并尝试运行命令scripts / web-server.js。 It just shows me "..." and when I go to the local host port 8000 it says couldn't connect. 它只是向我显示“......”,当我转到本地主机端口8000时,它说无法连接。

any ideas? 有任何想法吗?

You just need to: 你只需要:

git clone git://github.com/angular/angular-phonecat.git
cd angular-phonecat
node ./scripts/web-server.js

So the URL you are meant to enter into the browser is actually http://localhost:8000/angular-phonecat/app/index.html 因此,您要输入浏览器的URL实际上是http://localhost:8000/angular-phonecat/app/index.html

It depends on the directory you are in, if you just put: http://localhost:8000 in you will be able to navigate to the directory and open the index.html graphically. 这取决于你所在的目录,如果你只是把: http://localhost:8000 ,你将能够导航到该目录并以图形方式打开index.html。

Go to http://docs.angularjs.org/tutorial and follow the steps there. 转到http://docs.angularjs.org/tutorial并按照其中的步骤操作。 Specifically do the following - In command prompt navigate to your solution directory - ie Users\\"<>"\\angular-phonecat and run 具体做到以下几点 - 在命令提示符下导航到您的解决方案目录 - 即Users \\“<>”\\ angular-phonecat并运行

npm install npm安装

This command will download the following tools, into the node_modules directive: 此命令将下列工具下载到node_modules指令中:

Bower - client-side code package manager Bower - 客户端代码包管理器

http-server - simple local static web server http-server - 简单的本地静态Web服务器

Karma - unit test runner Karma - 单元测试运行器

protractor - end 2 end test runner 量角器 - 结束2端测试运行器

and then run the following command - 然后运行以下命令 -

npm start npm开始

and now you should be able to navigate to localhost:8000/app/index.html on your browser ! 现在你应该可以在你的浏览器上导航到localhost:8000 / app / index.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM