在本地主机中键入命令ng serve -o时无法运行Angular项目:4200

时间:2018-12-05 10:29:46

标签: node.js angular angular-cli angular7

当运行angular project显示错误时,在localhost:4200中键入命令ng serve -o时不运行angular project。 请在下面找到错误以及package.json

当运行angular project显示错误时,在localhost:4200中键入命令ng serve -o时不运行angular project。 请在下面找到错误以及package.json

PS E:\Angular\blog-niaz> ng serve -o
        ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
         91% additional asset processing scripts-webpack-plugin× 「wdm」: Error: EISDIR: illegal operation on a directory, read
            at Object.readSync (fs.js:491:3)
            at tryReadSync (fs.js:330:20)
            at Object.readFileSync (fs.js:367:19)
            at Storage.provideSync (E:\Angular\blog-niaz\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:98:13)
            at CachedInputFileSystem.readFileSync (E:\Angular\blog-niaz\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:259:32)
            at Observable.rxjs_1.Observable.obs [as _subscribe] (E:\Angular\blog-niaz\node_modules\@ngtools\webpack\src\webpack-input-host.js:35:51)
            at Observable._trySubscribe (E:\Angular\blog-niaz\node_modules\rxjs\internal\Observable.js:44:25)
            at Observable.subscribe (E:\Angular\blog-niaz\node_modules\rxjs\internal\Observable.js:30:22)
            at SyncDelegateHost._doSyncCall (E:\Angular\blog-niaz\node_modules\@angular-devkit\core\src\virtual-fs\host\sync.js:22:20)
            at SyncDelegateHost.read (E:\Angular\blog-niaz\node_modules\@angular-devkit\core\src\virtual-fs\host\sync.js:49:21)
            at WebpackCompilerHost.readFileBuffer (E:\Angular\blog-niaz\node_modules\@ngtools\webpack\src\compiler_host.js:124:44)
            at VirtualFileSystemDecorator.readFile (E:\Angular\blog-niaz\node_modules\@ngtools\webpack\src\virtual_file_system_decorator.js:39:54)
            at Promise (E:\Angular\blog-niaz\node_modules\@angular-devkit\build-angular\src\angular-cli-files\plugins\scripts-webpack-plugin.js:92:49)
            at new Promise (<anonymous>)
            at scripts.map.fullPath (E:\Angular\blog-niaz\node_modules\@angular-devkit\build-angular\src\angular-cli-files\plugins\scripts-webpack-plugin.js:91:24)
            at Array.map (<anonymous>)

在我的package.json中:

{
  "name": "blog-niaz",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.1.0",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/core": "~7.1.0",
    "@angular/forms": "~7.1.0",
    "@angular/http": "~7.1.0",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/platform-server": "~7.1.0",
    "@angular/router": "~7.1.0",
    "angular-font-awesome": "^3.1.2",
    "bootstrap": "^4.1.3",
    "core-js": "^2.5.4",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "material-icons": "^0.2.3",
    "materialize-css": "^1.0.0",
    "moment": "^2.22.2",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "~7.1.1",
    "@angular/compiler-cli": "~7.1.0",
    "@angular/language-service": "~7.1.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.6"
  }
}

1 个答案:

答案 0 :(得分:1)

已解决的问题

在我的情况下,我收到“ EISDIR:对目录的非法操作,请进行读取”,因为在我的.angular.json文件中,我没有在“脚本:”中提供完整路径。