【问题标题】:How to run Angular 2 App locally without node如何在没有节点的情况下在本地运行 Angular 2 App
【发布时间】:2017-08-06 21:13:06
【问题描述】:

所以我完成了这个使用 Angular 2 制作电影查找器应用程序的教程,但是我们总是必须在命令行中运行“npm start”。

当某人没有安装 Node.js 时,如何使他们能够在他们的机器上本地查看我的项目?

我的项目在下面: https://github.com/Jerick821/moviefinder

我还制作了以下批处理文件,我在网上找到但它不起作用:(

@echo off
cd moviefinder
npm install -g http-server
hs
start http://localhost:1234/

如何制作批处理文件来运行这个应用程序?

【问题讨论】:

  • npm 也是批处理文件吗?如果是这样,请使用call mpn install -g http-server 而不是npm install -g http-server...
  • npm 代表节点包管理器 - 如果他们没有安装节点,也很可能他们没有安装 npm。
  • 是的,他们很可能不会同时安装两者,我只想跳过 npm 进程并在本地运行该程序,以便人们可以立即打开它。可能有一些代码必须删除,但不太确定是哪一个。

标签: angularjs node.js angular batch-file


【解决方案1】:

Angular V2 Quickstart Guide使用Angular QuickStart DEMO

试试这个QuickStart example on Plunker而不安装任何东西。

<title>Angular Quickstart</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body {color:#369;font-family: Arial,Helvetica,sans-serif;}
</style>

<!-- Polyfills -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script>

<script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
  System.import('main.js').catch(function(err){ console.error(err); });
</script>

<body>
   <my-app>Loading AppComponent content here ...</my-app>
</body>

【讨论】:

    猜你喜欢
    • 2017-11-28
    • 1970-01-01
    • 2014-06-13
    • 2016-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-10
    • 1970-01-01
    相关资源
    最近更新 更多