错误:在工作空间中找不到项目“开始”

时间:2019-12-20 14:59:05

标签: angular npm

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)

package.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",
       ...
}

我已经尝试过所有从Google Stack溢出中获得的解决方案

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

1 个答案:

答案 0 :(得分:1)

要运行package.json中的命令,您需要使用npm run来调用它们。 npm将调用package.json内部的脚本。

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

npm run start:en