我正在尝试npm发布具有以下结构的angular2应用程序。
search-app
config
node_modules
src
api
--index.ts
--ping.ts
--search.ts
model
--index.ts
--model.ts
web
app
ping
--index.ts
--ping.css
--ping.html
--ping.ts
search
--index.ts
--search.css
--search.html
--search.ts
--app.css
--app.html
--app.module.ts
--app.ts
--index.html
--index.ts
package.json
tsconfig.json
Run Code Online (Sandbox Code Playgroud)
现在,我的“ npm run dist”命令是
"dist": "npm run rimraf -- dist && tsc src/index.ts src/web/index.ts src/model/index.ts -m commonjs --outDir dist --sourcemap --target es6 -d --pretty --noImplicitAny --experimentalDecorators --skipLibCheck"
Run Code Online (Sandbox Code Playgroud)
运行npm run dist将产生以下dist目录。
search-app
dist
api
--*.d.ts
--*.js
model
--*.d.ts
--*.js
web
app
ping
--*.d.ts
--*.js
search
--*.d.ts
--*.js
--*.d.ts
--*.js …Run Code Online (Sandbox Code Playgroud) 我正在使用 gitlab-ci 为我的 CI/CD 发布一个 NPM 模块到注册表。以下是我的 gitlab-ci.yml 文件
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
cache:
untracked: true
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
stages:
- setup
job-setup:
stage: setup
tags:
- angular
image: node:alpine
except:
- tags
script:
- npm set registry https://registry.npmjs.org
- npm i
- cp .npmrc ~/.npmrc
- npm publish --registry https://registry.npmjs.org
Run Code Online (Sandbox Code Playgroud)
我在发布命令上收到以下警告消息。模块已发布,但模块中的 /dist 文件夹丢失。
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` …Run Code Online (Sandbox Code Playgroud) $ npm login --scope=@username --registry=https://npm.pkg.github.com
$ Username: username
$ Password: ********
$ Email: (this IS public) example@gmail.com
$ npm ERR! code E401
$ npm ERR! 401 Unauthorized - PUT $ https://npm.pkg.github.com/-/user/org.couchdb.user:forinda - Error authenticating user: Requires authentication
$npm ERR! A complete log of this run can be found in:
$npm ERR! /home/orinda/.npm/_logs/2021-10-15T02_25_19_104Z-debug.log
Run Code Online (Sandbox Code Playgroud)
无法验证 npm 注册表和 github 我在填写密码时收到 401 错误 如何解决此问题
我正在尝试 npm 发布我的包https://github.com/kofifus/HyperappComponent
在 Windows cmd 中,我克隆了包,登录到 npm 然后尝试npm publish
我得到:
C:\Temp\HyperappComponent>npm publish
npm notice
npm notice package: hyperappcomponent@0.1.0
npm notice === Tarball Contents ===
npm notice 11.6kB LICENSE
npm notice 3.7kB index.js
npm notice 235B package.json
npm notice 4.2kB README.md
npm notice === Tarball Details ===
npm notice name: hyperappcomponent
npm notice version: 0.1.0
npm notice package size: 6.8 kB
npm notice unpacked size: 19.7 kB
npm notice shasum: 48dab5ae762c43ae9afe3a24df79edf07942082c
npm notice integrity: sha512-Xgf3YoCRPd68v[...]eLWhg8GH2wqWg==
npm notice total …Run Code Online (Sandbox Code Playgroud) 我构建了一个 TypeScript 模块并将其推送到 GitHub。我现在想在我的内部使用这个模块MyApp作为依赖项,它也是用 TypeScript 编写的。该包已在我的中注册MyApp/package.json:
"dependencies": {
"foo": "github:organization-xyz/foo",
}
Run Code Online (Sandbox Code Playgroud)
我添加了一个命令build-ts来JavaScript在我的foo模块中创建相应的绑定foo/package.json:
"scripts": {
"build-ts": "tsc"
...
},
Run Code Online (Sandbox Code Playgroud)
当然,当我调用npm i主应用程序时,不会执行该命令。我如何正确准备我的模块foo才能将其成功导入到我的应用程序中?
npm-publish ×5
npm ×3
angular ×1
github ×1
linux ×1
macos ×1
node.js ×1
npm-install ×1
npm-request ×1
npm-scripts ×1
typescript ×1