提问者:小点点

什么是正确的方式来设置一个将成为私有模块的TypeScript包?


在我的package.json中,我有:

{
    "name": "@myapp/models",
    "version": "1.0.3",
    "description": "My Models",
    "license": "ISC",
    "main": "build/index.js",
    "types": "build/index.d.ts",
    "scripts": {
        "postinstall": "yarn build",
        "build": "yarn cache clean && tsc"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/shamoons/mymodels"
    },
    "dependencies": {
        "pg": "^8.2.1",
        "reflect-metadata": "^0.1.13",
        "sequelize": "^5.21.12",
        "sequelize-typescript": "^1.1.0"
    },
    "devDependencies": {
        "@types/bluebird": "^3.5.32",
        "@types/node": "^14.0.13",
        "@types/validator": "^13.0.0",
        "typescript": "^3.9.5"
    }
}

但是当我npm安装到另一个回购时,我会得到:

/bin/sh: tsc: command not found

我做错了什么?


共1个答案

匿名用户

这是由于postinstall npm脚本造成的,该脚本在您安装软件包后运行。