npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

missing script: new-post

I have published a package on npm. Sometime last night I tried to install it and run it locally.

I am getting this error: missing script: new-post even though I have the script object in my package.json file.

Here is my package file:

  "name": "new-post-gatsby-starter-blog",
  "version": "1.1.5",
  "description": "create a new post in gatsby starter blog format with a simple command",
  "main": "/bin/index.js",
  "repository": {
    "type": "git",
    "url": "git+"
  "bin": {
    "new-post": "bin/new-post.js"
  "keywords": [
  "author": "Tiffany White",
  "license": "MIT",
  "bugs": {
    "url": ""
  "homepage": "",
  "devDependencies": {
    "date-fns": "^1.30.1",
    "slug": "^0.9.3",
    "slugify": "^1.3.4"
  "dependencies": {
    "shelljs": "^0.8.3"
  "scripts": {
    "new-post": "new-post"

My directory structure is a bin folder at the root of the package and inside that bin folder is the executable, new-post.js.

Not sure what I am doing wrong here.

I am on macOS 10.14.3
Using node 11.8 and the latest npm

I am a bit confused about the intended usage. What command did you run to install new-post, and what command did you run which said “missing script”?

I tried this:

npm install --global new-post-gatsby-starter-blog

The install did add a new-post command (so good start), and launched index.js, but that generated errors because index.js imports slug which is listed under devDependencies and so not included in my “production” install.

Can you explain why you also installed new-post along with the package and why you installed it globally? Can you give me some pointers as to how one could install it in a specific project?

This is basically just a script to create a new gatsby blog post.

Ooooooh okay. I got it to work. I just have a shelljs error somewhere in the executable. I will also have to update my README. I was running npm run new-post. Bit confused on the articles I’ve read.

Thanks for your help.