请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

使用npm run pub后报

按视频一步步来的,使用npm login登录成功后,使用npm run pub命令后就报了下面的错误,没法继续下去了,请问是什么问题呢?(rollup.config.ts,release.sh,tsconfig.json用的都是老师的源码)

测试在项目下使用  npm publish 可以正常把项目推到npm库上。

https://img1.sycdn.imooc.com//szimg/6308f4630983dd7512580628.jpg

https://img1.sycdn.imooc.com//szimg/6308f1110938c44113610960.jpghttps://img1.sycdn.imooc.com//szimg/6308f12309d7a13611561012.jpg

https://img1.sycdn.imooc.com//szimg/6308f11809edc4d400000000.jpg   


package.json略有改动。

    {
  "name": "ts-axios-yhysir",
  "version": "1.0.0",
  "description": "",
  "keywords": [],
  "main": "dist/axios.umd.js",
  "module": "dist/axios.es5.js",
  "typings": "dist/types/index.d.ts",
  "files": [
    "dist"
  ],
  "author": "yhysir <821136233@qq.com>",
  "repository": {
    "type": "git",
    "url": "https://github.com/yhysir/ts-axios"
  },
  "license": "MIT",
  "engines": {
    "node": ">=6.0.0"
  },
  "scripts": {
    "dev": "node examples/server.js",
    "lint": "tslint  --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
    "prebuild": "rimraf dist",
    "build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
    "start": "rollup -c rollup.config.ts -w",
    "test": "jest --coverage",
    "test:watch": "jest --coverage --watch",
    "test:prod": "npm run lint && npm run test -- --no-cache",
    "deploy-docs": "ts-node tools/gh-pages-publish",
    "report-coverage": "cat ./coverage/lcov.info | coveralls",
    "commit": "git-cz",
    "semantic-release": "semantic-release",
    "semantic-release-prepare": "ts-node tools/semantic-release-prepare",
    "precommit": "lint-staged",
    "travis-deploy-once": "travis-deploy-once",
    "prepub": "npm run test:prod && npm run build",
    "pub": "sh release.sh"
  },
  "lint-staged": {
    "{src,test}/**/*.ts": [
      "prettier --write",
      "git add"
    ]
  },
  "config": {
    "commitizen": {
      "path": "node_modules/cz-conventional-changelog"
    }
  },
  "jest": {
    "transform": {
      ".(ts|tsx)": "ts-jest"
    },
    "testEnvironment": "jsdom",
    "testRegex": "/test/.*\\.(test|spec)\\.(ts)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "coveragePathIgnorePatterns": [
      "/node_modules/",
      "/test/"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 90,
        "functions": 95,
        "lines": 95,
        "statements": 95
      }
    },
    "collectCoverageFrom": [
      "src/*.{js,ts}",
      "src/**/*.{js,ts}"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/test/boot.ts"
    ]
  },
  "prettier": {
    "semi": false,
    "singleQuote": true
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  },
  "devDependencies": {
    "@commitlint/cli": "^7.1.2",
    "@commitlint/config-conventional": "^7.1.2",
    "@types/jest": "^24.0.13",
    "@types/node": "^10.11.0",
    "@types/nprogress": "0.0.29",
    "@types/qs": "^6.5.3",
    "@types/jasmine-ajax": "^3.1.39",
    "atob": "^2.1.2",
    "body-parser": "^1.18.3",
    "colors": "^1.3.2",
    "commitizen": "^3.0.0",
    "connect-multiparty": "^2.2.0",
    "cookie-parser": "^1.4.4",
    "coveralls": "^3.0.2",
    "cross-env": "^5.2.0",
    "css-loader": "^2.1.1",
    "cz-conventional-changelog": "^2.1.0",
    "express": "^4.16.4",
    "husky": "^1.0.1",
    "jest": "^24.8.0",
    "jest-config": "^24.8.0",
    "lint-staged": "^8.0.0",
    "lodash.camelcase": "^4.3.0",
    "nprogress": "^0.2.0",
    "prettier": "^1.14.3",
    "prompt": "^1.0.0",
    "qs": "^6.7.0",
    "replace-in-file": "^3.4.2",
    "rimraf": "^2.6.2",
    "rollup": "^0.67.0",
    "rollup-plugin-commonjs": "^9.1.8",
    "rollup-plugin-json": "^3.1.0",
    "rollup-plugin-node-resolve": "^3.4.0",
    "rollup-plugin-sourcemaps": "^0.4.2",
    "rollup-plugin-typescript2": "^0.18.0",
    "semantic-release": "^15.9.16",
    "shelljs": "^0.8.3",
    "style-loader": "^0.23.1",
    "travis-deploy-once": "^5.0.9",
    "ts-jest": "^24.0.2",
    "ts-loader": "^5.3.3",
    "ts-node": "^7.0.1",
    "tslint": "^5.11.0",
    "tslint-config-prettier": "^1.15.0",
    "tslint-config-standard": "^8.0.1",
    "tslint-loader": "^3.5.4",
    "typedoc": "^0.12.0",
    "typescript": "^3.4.5",
    "webpack": "^4.28.4",
    "webpack-dev-middleware": "^3.5.0",
    "webpack-hot-middleware": "^2.24.3",
    "jasmine-ajax": "^4.0.0",
    "jasmine-core": "^3.4.0"
  }
}
下载视频          

正在回答 回答被采纳积分+3

1回答

ustbhuangyi 2022-09-03 20:59:05

https://github.com/alexjoverm/typescript-library-starter
这个 repo 以及不维护了,不行就用课程的源码,初始化 package.json 以及目录

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信