ng新的不工作状态错误-使用前需要加载工作区

时间:2019-05-30 11:33:32

标签: angular-cli

尝试使用Angular CLI 8创建新的angular应用程序时,它显示的错误与ng update相同

我有很多时间重新安装了cli和node。 还更新了本地cli

ng new ng8
Workspace needs to be loaded before it is used.
Error: Workspace needs to be loaded before it is used.
    at Workspace._assertLoaded (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:108:19)
    at Workspace._getTool (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:214:14)
    at Workspace.getCli (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:196:21)
    at NewCommand.getDefaultSchematicCollection (/usr/local/lib/node_modules/@angular/cli/models/schematic-command.js:266:36)
    at NewCommand.parseCollectionName (/usr/local/lib/node_modules/@angular/cli/commands/new-impl.js:41:43)
    at NewCommand.initialize (/usr/local/lib/node_modules/@angular/cli/commands/new-impl.js:22:40)
    at NewCommand.validateAndRun (/usr/local/lib/node_modules/@angular/cli/models/command.js:127:20)
    at async Object.runCommand (/usr/local/lib/node_modules/@angular/cli/models/command-runner.js:178:24)
    at async default_1 (/usr/local/lib/node_modules/@angular/cli/lib/cli/index.js:32:31)

2 个答案:

答案 0 :(得分:0)

尝试删除您的.angular-config.json,它对我有用。

rm ~/.angular-config.json 

答案 1 :(得分:0)

当我不小心用空白内容重写~/.angular-config.json时遇到了同样的问题。

删除此文件可解决此问题。