错误:构建角度asp.net应用程序时找不到本地工作区文件('angular.json')

时间:2018-07-21 07:48:51

标签: asp.net angular

enter image description here我正在尝试从链接https://www.pointblankdevelopment.com.au/blog/134/aspnet-core-20-angular-24-user-registration-and-login-tutorial-example取来的IIS服务器上部署ASP.NET Core 2.0 + Angular 2/4-用户注册和登录应用程序

我能够在Visual Studio Community 2017中成功导入项目,并使用“ npm i”和“ npm start”通过终端运行应用程序

但是,当我尝试使用命令“ ng build --prod --base-href / loginreg /”来构建项目时,出现如下图所示的错误.....

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:37:19)
    at WorkspaceLoader.loadWorkspace (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:24:21)
    at TestCommand._loadWorkspaceAndArchitect (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:177:32)
    at TestCommand.<anonymous> (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:45:25)
    at Generator.next (<anonymous>)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:3:12)
    at TestCommand.initialize (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:44:16)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/command-runner.js:100:23

然后再次从项目中删除了nodemodules文件夹和package-lock.json文件,并运行cmd“ npm install”,“ npm start”,然后运行“ ng build --prod --base-href / loginreg /”,但它不起作用。

我还尝试通过引用各种解决方案来运行以下命令“ ng update @ angular / cli --migrate-only --from = 1.7.4”。但是iam再次面临相同的问题。

后来我也尝试了“ ng build --prod --aot = false --build-optimizer = false”命令,我无法解决它。.

有人可以解决我的问题吗??

这是我的package.json文件

{
    "name": "aspnet-core-angular2-registration-login-example-client",
    "version": "1.0.0",
    "description": "Client for ASP.NET Core with Angular 2/4 User Registration and Login Example",
    "repository": {
        "type": "git",
        "url": "https://github.com/cornflourblue/aspnet-core-angular2-registration-login-example.git"
    },
    "scripts": {
        "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
        "lite": "lite-server",
        "tsc": "tsc",
        "tsc:w": "tsc -w"
    },
    "license": "MIT",
    "dependencies": {
        "@angular/common": "^4.4.5",
        "@angular/compiler": "^4.4.5",
        "@angular/core": "^4.4.5",
        "@angular/forms": "^4.4.5",
        "@angular/http": "^4.4.5",
        "@angular/platform-browser": "^4.4.5",
        "@angular/platform-browser-dynamic": "^4.4.5",
        "@angular/router": "^4.4.5",
        "core-js": "^2.5.1",
        "rxjs": "^5.4.3",
        "systemjs": "^0.20.19",
        "zone.js": "^0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^6.0.0-rc.4",
        "@types/node": "^8.0.34",
        "concurrently": "^3.5.0",
        "lite-server": "^2.3.0",
        "typescript": "^2.5.3"
    }
}

0 个答案:

没有答案