How to publish a Typescript module in NPM?

0

Hello, folks, I built a Typescript module to use on NodeJS, but I'm having trouble using it. I got to publish, I followed some tutorials that I found, but without success. I open another digital project

  

npm i xxx-xxx

It lowers dependency and everything, but if I try

  

npm i @ types / xxx-xxx

He says he can not find the module. Beauty, I tried to use it even when it was time to try

  

node index.js

In the new module I get this error

  

Can not find module 'xxx-xxx'

This is my package.json

    {
  "name": "xxx-xxx",
  "version": "1.0.2",
  "description": "Blah blah blah",
  "main": "dist/index.ts",
  "types": "dist/index.d.ts",
  "scripts": {
    "test": "echo no tests"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.3",
    "express": "^4.16.3",
    "@types/body-parser": "^1.17.0",
    "@types/express": "^4.16.0"
  },
  "devDependencies": {
    "typescript": "^3.0.3"
  }
}

And this is my tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "experimentalDecorators": true,
        "module": "commonjs",
        "declaration": true,
        "outDir": "./dist",
        "strict": true
    }
}

Thank you!

    
asked by anonymous 11.09.2018 / 04:48

0 answers