尝试在angular cli中创建库时出现以下错误
Schematic "library" not found in collection "@schematics/angular".
Error: Schematic "library" not found in collection
"@schematics/angular".
at SchematicEngine.createSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:143:23)
at CollectionImpl.createSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29)
at Object.getSchematic (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/utilities/schematics.js:47:23)
at Class.run (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/tasks/schematic-get-options.js:12:40)
at Class.beforeRun (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/commands/generate.js:101:31)
at Promise.resolve.then (/home/rafaelvicio/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:138:24)
at <anonymous>
命令ng --version
显示了这个
Angular CLI: 1.7.4
Node: 8.9.3
OS: linux x64
Angular:
node -v
v8.9.3
npm -v
5.5.1
答案 0 :(得分:2)
npm i -g @angular/cli
将您更新为最新版本的原理图。 更新角度cli也很重要:
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
template<class Haystack, class Needle, class OutputIterator>
void separate(Haystack&& haystack, Needle&& needle, OutputIterator output_iter)
{
const char* sep = "";
auto first = std::begin(haystack);
auto last = std::end(haystack);
auto first_needle = std::begin(needle);
auto last_needle = std::end(needle);
auto needle_length = std::distance(first_needle, last_needle);
while (first != last)
{
auto next = std::search(first, last, first_needle, last_needle);
if (next == first)
{
first = std::next(first, needle_length);
}
else
{
std::cout << sep;
std::copy(first, next, output_iter);
sep = " ";
first = next;
}
}
}
int main()
{
using namespace std::literals;
const auto needle = "FOO"s;
const auto haystack = "FOOTHEFOOFOOBEST"s;
separate(haystack, needle, std::ostream_iterator<char>(std::cout, ""));
return 0;
}
答案 1 :(得分:1)
图书馆支持从Angular cli版本6&amp;以上...
请查看release note以获取更多信息......
答案 2 :(得分:1)
这对我有用:
npm i @schematics/angular
答案 3 :(得分:0)
ng config cli.defaultCollection @ ngrx / schematics