【问题标题】:npm start server errorsnpm 启动服务器错误
【发布时间】:2018-10-18 02:45:12
【问题描述】:

我正在尝试启动我的 npm 服务器(是的,我已经删除了 nodes_module 文件夹和 package-lock.json 文件)并且 npm 多次安装在同一位置。我也试过ng update @angular/cli

任何帮助将不胜感激。

我现在收到以下错误

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\workspace-loader.js:44:19)
    at WorkspaceLoader.loadWorkspace (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\workspace-loader.js:31:21)
    at BuildCommand._loadWorkspaceAndArchitect (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\architect-command.js:201:32)
    at BuildCommand.<anonymous> (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\architect-command.js:53:25)
    at Generator.next (<anonymous>)
    at C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\architect-command.js:3:12)
    at BuildCommand.initialize (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\architect-command.js:52:16)
    at Object.<anonymous> (C:\Users\Shawn Rahmani\Documents\GitHub\Community-Solar-Enrollment-Flow\node_modules\@angular\cli\models\command-runner.js:127:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

【问题讨论】:

  • 这个方法以前有效吗?您可以签出旧版本并查看它是否运行?
  • 是的,它以前工作过 - 我可以试一试
  • @SRahmani 这可能会帮助你filipmolcik.com/…
  • @SRahmani 只要确保 Angular cli 的全局版本和本地版本匹配
  • @JameelM 我可能应该澄清一下我只是想在本地运行 - 那有关系吗?

标签: node.js angular typescript npm


【解决方案1】:

你试过这个命令吗? npm 缓存清理 -f

【讨论】:

    【解决方案2】:

    听起来要么你不在同一个目录中,要么你最近升级了节点。

    您可以使用ng update 而不是npm upgrade

    点击这里了解更多信息

    https://github.com/angular/angular-cli/wiki/update

    您还应该检查您是否有一个 angular-cli.json 文件,该文件已重命名为 angular.json 以用于较新的版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-21
      • 2020-04-06
      • 1970-01-01
      • 1970-01-01
      • 2015-08-19
      • 2019-02-26
      • 2017-06-14
      相关资源
      最近更新 更多