Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including pkg-ok with all npm packages installed. Try it out:

var pkgOk = require("pkg-ok")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pkg-ok v2.3.1

Checks package.json main and bin paths

pkg-ok Build Status npm

pkg-ok checks paths and scripts defined in package.json before you publish 👌

  • Ensures paths defined in main, bin, module, types, typings, es2015 and browser exist
  • Ensures bin scripts use cross-platform line endings


npm install pkg-ok --save-dev
// package.json
  "main": "oops_this_file_doesnt_exist.js",
  "scripts": {
    "prepublishOnly": "... && pkg-ok"
npm publish
# Error!
# Since main file doesn't exist, publish is blocked 


pkg-ok can be configured to check additional package.json fields or bin files

pkgOk --field someField --bin


const pkgDirectory = __dirname

pkgOk(pkgDirectory, {
  fields: ['someAdditonalField'],
  bin: ['']



Patreon - Supporters

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free