npm启动服务器错误

时间:2018-10-17 13:58:02

标签: node.js angular typescript npm

我试图启动我的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

2 个答案:

答案 0 :(得分:0)

您是否尝试过此命令? npm cache clean -f

答案 1 :(得分:0)

听起来好像您不在同一目录中,或者您最近升级了节点。

除了执行npm upgrade之外,您还可以执行ng update

在此处查看更多信息

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

您还应该检查是否有angular-cli.json文件,对于较新的发行版,该文件已重命名为angular.json