Angular:ng生成不起作用

时间:2018-02-21 11:12:58

标签: angular-cli

Apples-MacBook-Pro:Basic Atreya$ ng generate component servers

/Users/apple/Projects/NodeProject/Basic/node_modules/@angular/cli/models/config/config.js:89
            throw new InvalidConfigError(common_tags_1.stripIndent `
            ^

InvalidConfigError: Parsing '/Users/apple/Projects/NodeProject/Basic/.angular-cli.json' failed. Ensure the file is valid JSON.
Error: Unexpected string in JSON at position 547
    at Function.fromConfigPath (/Users/apple/Projects/NodeProject/Basic/node_modules/@angular/cli/models/config/config.js:89:19)
    at Function.fromProject (/Users/apple/Projects/NodeProject/Basic/node_modules/@angular/cli/models/config.js:67:46)
    at Object.<anonymous> (/Users/apple/Projects/NodeProject/Basic/node_modules/@angular/cli/commands/build.js:10:35)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)

1 个答案:

答案 0 :(得分:0)

您似乎正在从不是ng generate创建的项目中调用angular-cli。它试图找到angular.cli.json并失败。

尝试导航到使用ng new生成的文件夹并在那里运行命令。