小编and*_*mel的帖子

如何调试'npm ERR!403 在大多数情况下,您或您的依赖项之一正在请求您的安全策略禁止的包版本。

我目前正在尝试设置一个 Jenkins 和一个私有 npm 存储库(Sonatype Nexus)。当我尝试在 Jenkins 构建管道中发布到存储库时,出现以下错误。

+ npm publish --registry https://<my-private-registry>/repository/npm-private/
npm notice 
npm notice package: ts-acoustics@0.0.0
npm notice === Tarball Contents === 
npm notice 2.4kB  Jenkinsfile                       
...
('notice' level info about the files)
...
npm notice === Tarball Details === 
npm notice name:          ts-acoustics                            
npm notice version:       0.0.0                                   
npm notice package size:  13.8 kB                                 
npm notice unpacked size: 47.5 kB                                 
npm notice shasum:        554b6d2b41321d78e00f6a309bb61c9181a2e3d6
npm notice integrity:     sha512-QtExdu6IqZ+lH[...]r+HXolo4YCFPg==
npm notice total files:   17                                      
npm notice 
npm ERR! …
Run Code Online (Sandbox Code Playgroud)

nexus npm typescript jenkins-pipeline

38
推荐指数
5
解决办法
3万
查看次数

错误导致 TypeScript 无法识别属性

我偶然发现可以在 javascript 中向 Error 构造函数添加原因

但是,当我尝试使用此功能时,我的应用程序无法启动,因为它不知道这个“新”构造函数参数。

> tsc && node dist/index.js
promo/promo-service/am-promo-request-handler.ts:43:104 - error TS2554: Expected 0-1 arguments, but got 2.        
43         throw new Error(`Can't read Maxmind GeoLite2 City db from mmdb file '${config.pathMmdbCity}'`, { cause: err});
Found 1 error in promo/promo-service/am-promo-request-handler.ts:43 
Run Code Online (Sandbox Code Playgroud)

以下所有命令均因上述编译错误而停止

nodemon
tsc && node dist/index.js
ts-node index.ts
Run Code Online (Sandbox Code Playgroud)

我将以下脚本添加到我的 package.json 中(确保询问正确的节点实例和其他工具的版本)

"check": "nodemon -v && node -v && tsc -v && ts-node -v && npm -v"
Run Code Online (Sandbox Code Playgroud)

它返回

2.0.19
v16.14.2
Version 4.7.4
v10.9.1
8.17.0
Run Code Online (Sandbox Code Playgroud)

该功能应该从节点版本 10.9.0 …

javascript node.js typescript nodemon ts-node

24
推荐指数
2
解决办法
9453
查看次数

即使我指定了另一个用户,ansible也会与默认的remote_user连接

我使用主机上的 ansible 模块创建了一个虚拟 Linux 服务器。这很好用。下一个任务应该使用添加用户“ansible”

- include: task-files/users_create_ansible_user.yml
    delegate_to: '{{ createdserver.ipv4_address }}'
    remote_user: root
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我在此处添加了remote_user(我还将其添加到了包含的任务中)。

但是,尽管有这两个remote_user条目,它仍然尝试与ansible.cfg中设置的remote_user连接(我将remote_user设置为“ansible”,因为我想在创建该用户后对其执行以下所有任务)。

更多细节:

这是包含的任务文件中的第一个任务(失败)

- name: "Create 'ansible' user"
  remote_user: root
  user:
    name: "ansible"
Run Code Online (Sandbox Code Playgroud)

返回

fatal: [localhost]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ansible@116.203.119.43: Permission denied (publickey,password).", "unreachable": true}'
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,它不与指定的remote_user: root 连接,而是与用户“ansible”(尚未创建)连接。当我将 ansible.cfg 中的remote_user更改为root时...它可以连接到这里。

谁能指导我纠正我的错误观念?

ansible

2
推荐指数
1
解决办法
3086
查看次数

错误 TS5023:未知的编译器选项“strictTemplates”

编译 Angular 应用程序 (v10) 失败并出现此错误。

An unhandled exception occurred: tsconfig.json:14:5 - error TS5023: Unknown compiler option 'strictTemplates'.

14     "strictTemplates": true,
       ~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

ivy typescript tsconfig angular

2
推荐指数
1
解决办法
736
查看次数

错误 TS2304:使用 karma-typescript 时找不到名称“地图”

我尝试使用karma-typescript和 jasmine 运行我的第一个 spec.ts 文件。

我已经遇到了很多不同的错误,我用谷歌搜索并“修复”了这些错误,但我总是遇到其他问题。

  • 我在 tsconfig.json->compilerOptions->"lib" 中添加了不同的条目
  • 试图改变目标
  • 尝试了 @types/core-js 版本 0.9.46 和 0.9.35
  • 将节点从 8.9.4 更新到 8.11.2
  • 尝试将 @types/node 降级到某个 8.x 版本

运行应用程序没有问题。只是测试不编译。

我需要以不同的方式配置 karma 编译器吗?

目前我只使用1中的“最小业力配置” 。

module.exports = function(config) {
config.set({
    frameworks: ["jasmine", "karma-typescript"],
    files: [
        "src/**/*.ts" // *.tsx for React Jsx
    ],
    preprocessors: {
        "**/*.ts": "karma-typescript" // *.tsx for React Jsx
    },
    reporters: ["progress", "karma-typescript"],
    browsers: ["Chrome"]
  });
};
Run Code Online (Sandbox Code Playgroud)

当前的错误是

> ts-node node_modules/karma/bin/karma start ./karma.conf.js

29 05 2018 …
Run Code Online (Sandbox Code Playgroud)

typescript karma-jasmine karma-typescript

1
推荐指数
1
解决办法
2435
查看次数

Docker 中的 Docker - Jenkins Docker Pipeline - 如何连接到外部服务

我有以下设置

  • jenkins 在 docker 容器中运行
  • 在同级 docker 容器中,我运行一个私有 npm 注册表
  • 我使用 Docker Pipeline 插件和 Jenkinsfile 构建打字稿库(带有节点 docker 容器)
  • 我想将该库发布到该私有注册表,以便能够在其他构建作业中使用它

问题是,由于注册表在主机上的端口上运行,因此无法从构建脚本生成的构建库的 docker 容器中的 docker 访问它。我没有找到有关如何在 jenkinsfile 中执行类似 --net="host" (来自 docker run)之类的操作的信息。我想这会起作用吗?

知道如何改进通过节点 docker 容器构建的设置,但能够发布到注册表吗?

jenkins-pipeline docker-in-docker verdaccio

1
推荐指数
1
解决办法
3362
查看次数