Angular 2 - 应用程序找不到它的节点模块目录

时间:2017-03-27 13:59:05

标签: angular

我将我的角度项目复制到wamp服务器(模块目录除外)

我运行了npm install,运行正常但是现在如果我在浏览器中运行索引,则node_modules不在src文件夹中,而是给出了404

(我的项目基于角度2教程种子 - systemJS)

project folder
    node_modules
    src
        index.html

index.html:

...
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>

可以看出,主index.html保存了对应该在同一级别的node_modules的引用,但是在项目文件夹中node_modules是在父文件夹中

  • 它甚至可以在轻型服务器下工作,而node_modules应该在&#34; src&#34;文件夹?

  • 如何让它在运行apache的服务器上运行(我想到目前为止我必须手动移动文件夹)?

screenshot

这是package.json: 无论我运行任何命令,都不会创建一些可在生产中使用的dist目录

{
  "name": "angular-catalog",
  "version": "1.0.0",
  "description": "Catalog",
  "scripts": {
    "build": "tsc -p src/",
    "build:watch": "tsc -p src/ -w",
    "build:e2e": "tsc -p e2e/",
    "serve": "lite-server -c=bs-config.json",
    "serve:e2e": "lite-server -c=bs-config.e2e.json",
    "prestart": "npm run build",
    "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
    "pree2e": "npm run build:e2e",
    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
    "preprotractor": "webdriver-manager update",
    "protractor": "protractor protractor.config.js",
    "pretest": "npm run build",
    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
    "pretest:once": "npm run build",
    "test:once": "karma start karma.conf.js --single-run",
    "lint": "tslint ./src/**/*.ts -t verbose"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "angular-in-memory-web-api": "~0.2.4",
    "angular2-cookie": "^1.2.6",
    "core-js": "^2.4.1",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "zone.js": "^0.7.4"
  },
  "devDependencies": {
    "concurrently": "^3.2.0",
    "lite-server": "^2.2.2",
    "typescript": "~2.0.10",
    "canonical-path": "0.0.2",
    "tslint": "^3.15.1",
    "lodash": "^4.16.4",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "@types/node": "^6.0.46",
    "@types/jasmine": "2.5.36"
  },
  "repository": {}
}

感谢

[编辑:我必须评论&lt; base ...&gt;在html文件中标记并将node_modules移动到src文件夹以使其工作......我不明白,为什么它实现得如此糟糕,我在这里缺少什么???]

0 个答案:

没有答案