首页 > 解决方案 > 错误:在工作区中找不到项目“开始”

问题描述

ng run start:en 命令是抛出异常。

Project 'start' could not be found in workspace.
    Error: Project 'start' could not be found in workspace.
        at Workspace.getProject (...node_modules\@angular-devkit\core\src\workspace\workspace.js:93:19)
        at Architect.getBuilderConfiguration (node_modules\@angular-devkit\architect\src\architect-legacy.js:117:41)
        at RunCommand.runSingleTarget (\node_modules\@angular\cli\models\architect-command.js:160:45)
        at RunCommand.runArchitectTarget (node_modules\@angular\cli\models\architect-command.js:201:35)
        at RunCommand.run node_modules\@angular\cli\commands\run-impl.js:14:25)
        at RunCommand.validateAndRun (node_modules\@angular\cli\models\command.js:124:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
        at Function.

    Module.runMain (internal/modules/cjs/loader.js:745:11)
            at startup (internal/bootstrap/node.js:283:19)
            at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

包.json

"scripts": {
"ng": "ng",
    "start": "ng serve",
    "start:ur": "ng serve --configuration=ed",
    "start:en": "ng serve --configuration=en",
    "build": "ng build",
    "build:ur": "ng build --configuration=ed",
    "build:en": "ng build --configuration=en",
       ...
}

我已经尝试了从谷歌堆栈溢出中获得的所有可能的解决方案

  1. 删除node_module文件夹
  2. package-lock.json
  3. 更改 npm 版本

标签: angularnpm

解决方案


要从 运行命令package.json,您需要使用 调用它们npm runnpm将调用里面的脚本package.json

因此,对于您要在其中运行start:en脚本的问题package.json,您需要运行

npm run start:en

推荐阅读