- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试构建我的 Angular 库时,出现以下错误:架构验证失败,出现以下错误:数据路径“/error”必须是字符串。
;
在我从 Angular 12 迁移到 Angular 13 之前,我一直收到此错误。
这是我在“主应用程序”中的 angular.json
中的声明:
"projectname": {
"projectType": "library",
"root": "projects/projectname",
"sourceRoot": "projects/projectname/src",
"prefix": "pn",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/projectname/tsconfig.lib.json",
"project": "projects/projectname/ng-package.json",
},
"configurations": {
"production": {
"tsConfig": "projects/projectname/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/projectname/src/test.ts",
"tsConfig": "projects/projectname/tsconfig.spec.json",
"karmaConfig": "projects/projectname/karma.conf.js"
}
}
}
}
这是我的“主应用程序”的 package.json:
"name": "mainApplication",
"version": "2.0.0",
"private": true,
"devDependencies": {
"@angular-builders/custom-webpack": "^13.1.0",
"@angular-devkit/build-angular": "~13.3.0",
"@angular-eslint/builder": "13.1.0",
"@angular-eslint/eslint-plugin": "13.1.0",
"@angular-eslint/eslint-plugin-template": "13.1.0",
"@angular-eslint/schematics": "^13.1.0",
"@angular-eslint/template-parser": "13.1.0",
"@angular/cli": "~13.3.0",
"@angular/compiler-cli": "~13.3.0",
"@angular/language-service": "~13.3.0",
"@biesbjerg/ngx-translate-extract": "^7.0.4",
"@biesbjerg/ngx-translate-extract-marker": "^1.0.0",
"@types/file-saver": "^2.0.5",
"@types/hashids": "^2.0.1",
"@types/moment-timezone": "^0.5.12",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "5.15.0",
"@typescript-eslint/parser": "5.15.0",
"autoprefixer": "^10.4.4",
"eslint": "^8.11.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsdoc": "38.0.4",
"eslint-plugin-prefer-arrow": "1.2.3",
"hashids": "^2.2.10",
"html-webpack-plugin": "^5.5.0",
"invariant": "^2.2.4",
"postcss": "^8.4.12",
"typescript": "~4.6.2",
"webpack-bundle-analyzer": "^4.5.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "ng build",
"build:dev": "ng build",
"build:prod": "ng build --configuration production",
"build:stats": "ng build --stats-json",
"build:stats-prod": "ng build --stats-json --configuration production",
"test": "karma start test/karma.conf.js",
"serve": "ng serve --hmr --ssl --disable-host-check",
"analyze": "webpack-bundle-analyzer dist/payweb/de/stats.json",
"i18n": "ng xi18n --ivy --output-path app/i18n/ --format xliff2",
"i18n:extract": "find ./app/components/ -name 'i18n' -type d -exec ngx-translate-extract -i {}/../ -o {}/de.json --key-as-default-value -f namespaced-json --fi ' ' \\;",
"i18n:init": "find ./app/components/ -name 'i18n' -type d -exec ngx-translate-extract -i {}/../ -o {}/template.json --replace --key-as-default-value -f namespaced-json --fi ' ' \\;"
},
"dependencies": {
"@angular/animations": "^13.3.0",
"@angular/cdk": "^13.3.0",
"@angular/common": "^13.3.0",
"@angular/compiler": "^13.3.0",
"@angular/core": "^13.3.0",
"@angular/flex-layout": "^13.0.0-beta.38",
"@angular/forms": "^13.3.0",
"@angular/localize": "^13.3.0",
"@angular/material": "~13.3.0",
"@angular/material-moment-adapter": "^13.3.0",
"@angular/platform-browser": "^13.3.0",
"@angular/platform-browser-dynamic": "^13.3.0",
"@angular/router": "^13.3.0",
"@ngrx/component": "^13.0.2",
"@ngrx/effects": "^13.0.2",
"@ngrx/entity": "^13.0.2",
"@ngrx/router-store": "^13.0.2",
"@ngrx/schematics": "^13.0.2",
"@ngrx/store": "^13.0.2",
"@ngrx/store-devtools": "^13.0.2",
"@ngx-translate/core": "^14.0.0",
"compare-versions": "^4.1.3",
"file-saver": "^2.0.5",
"messageformat": "^2.3.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.34",
"ng-packagr": "^13.3.0",
"ngx-file-helpers": "^7.0.0",
"ngx-filesaver": "^13.0.0",
"ngx-moment": "^6.0.2",
"ngx-translate-messageformat-compiler": "^5.0.1",
"rxjs": "^7.5.5",
"tslib": "^2.3.1",
"uuid": "^8.3.2",
"zone.js": "~0.11.5"
}
这是我库中的 package.json:
{
"name": "projectname",
"version": "0.0.2",
"peerDependencies": {
"@angular/common": "^13.3.0",
"@angular/core": "^13.3.0",
"tslib": "^2.3.1"
}
}
如果您需要更多信息,请告诉我。
最佳答案
我遇到了同样的错误,并找到了适合我的上下文的解决方案。
上下文
我有一个包含应用程序和库的单一存储库。库分为子库。
▾ libraries/
▾ my-library/
▾ src/
▾ lib/
▾ sub-library-1/
sub-library-1.module.ts
package.json
▾ sub-library-2/
sub-library-2.module.ts
package.json
▾ sub-library-3/
sub-library-3.module.ts
package.json
▾ sub-library-4/
sub-library-4.module.ts
package.json
index.ts
ng-package.json
package.json
在库外部,内部库结构是隐藏的,因此如果应用程序使用 sub-library-3
的成员,它只需要:
import { Member } from 'my-library'
但是如果一个内部库消费另一个内部库,eg:
Member of sub-library-2
消费一个Member of sub-library-3
,导入应该是绝对的:
import { Member of sub-library-3 } from 'my-library/src/lib/sub-library-3';
问题
我得到这个错误是因为我错误地使用了相对路径:
import { Member of sub-library-3 } from '../sub-library-3';
解决方案
将其更改为使用绝对路径,解决了问题
import { Member of sub-library-3 } from 'my-library/src/lib/sub-library-3';
这可能不是您的确切情况,因为错误可能是由于在非常不同的上下文中错误导入而发生的,但根据我的经验,大多数此类问题都是由错误的导入路径引起的。
希望对你有帮助
关于angular - 为什么我收到以下错误 'Data path "/错误“必须是字符串。”关于以 Angular 构建我的图书馆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72213002/
这是我的作业 What does echo PATH $PATH \$PATH do? 我不知道它是如何工作的。 echo PATH打印“路径” $PATH创建一个“PATH”变量......也许?
我想弄清楚两者之间的区别 路径=路径+[节点1] 路径+=[节点1] path.append(node1) 我得到的是 path = path + [node1] 的正确路径,但不是其他两个。 def
我使用 Robot 框架在 Ride 中创建了一个测试用例。运行时出现错误。 我更新了python的路径。我更新了库和 Ride。我换了文件夹还是不行 *** Settings *** Documen
我尝试使用额外的功能自定义 pathlib.Path()。特别是,我真的很喜欢使用上下文管理器作为移入和移出目录的方法。我一直在使用它,但我似乎在让 Path() 与自定义上下文管理器一起工作时遇到错
编辑:基于 Ulf Rompe 的评论,重要的是使用“1”而不是“0”,否则您将破坏 sys.path . 我已经做 python 很长一段时间了(一年多),我总是很困惑为什么人们建议你使用 sys.
我有兴趣这样做的原因是因为我的路径中有一部分将保持不变,但我希望将其与其所有父部分一起删除。 所以如果我们说, some/unknown/path/foo/bar/baz 我想回去 bar/baz 但
在几个 SO 的问题中,有这些行可以访问代码的父目录,例如os.path.join(os.path.dirname(__file__)) returns nothing和 os.path.join(o
我已经在我的 Linux 中安装了 anaconda 来导入 python 包。 安装 anaconda 后,我无法在 python 中使用 anaconda,经过一番搜索后我发现输入此命令我能够使用
哪个更好用,为什么?我的意思是这两个命令在哪些方面不同以及如何不同?性能、可读性…… new FileInfo(path).Name 或 Path.GetFileName(path) 最佳答案 因为您
这不适用于某些设备。 在三星设备中,他们不允许使用下载管理器下载文件。 我已经在 list 中定义了权限并获得了运行时权限。 DownloadManager downloadManager = (Do
我想知道在这个例子中使用 Paths.get() 和 Path.resolve 有什么区别: public static void main(String[] args) { Path p1
目前我正在开发一个转换由 Inkscape 创建的 svg-paths 的应用程序。现在我不清楚关于绝对和相对路径组合的路径规范。规范是否说明了同时包含相对和绝对坐标的路径定义? 特别是关于绝对贝塞尔
我正在编写脚本,我需要在用户的 $PATH 上查找命令并获取该命令的完整路径。问题是我不知道用户的登录 shell 是什么,或者他们的 do 文件中可能有什么奇怪的东西。我将 bourne shell
Metalsmith 的文档对 path() 函数没有太多解释:#path(paths...): Resolve any amount of paths... relative to the work
我知道我可以通过 regedit 更改我的 wine PATH,但实际上我只需要为一次运行更改 PATH。 例如,我的软件名为frontend.exe,这取决于example/mylib.dll,我需
因此,绝对路径是一种到达某个文件或位置的方法,描述了它的完整路径、完整路径,并且它依赖于操作系统(Windows 和 Linux 的绝对路径,例如,不同)。另一方面,相对路径是从当前位置 ..(两个点
我对编程有点陌生(不是真的,但我仍在学习 - 我们不是吗?)。虽然我了解 Java 和 Python,并且了解 C、C++、JS、C#、HTML、CSS 等(并且我可以在终端中很好地导航),但我不熟悉
我对编程有点陌生(不是真的,但我仍在学习 - 我们不是吗?)。虽然我了解 Java 和 Python,并且了解 C、C++、JS、C#、HTML、CSS 等(并且我可以在终端中很好地导航),但我不熟悉
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
使用环境变量(如 PATH)作为 $PATH 或 ${PATH} 有什么区别? 最佳答案 在大多数情况下没有区别。唯一重要的是你是否想在扩展后包含尾随文本。例如,假设您的 PATH 包含字符串 FOO
我是一名优秀的程序员,十分优秀!