Home > Blockchain >  Trouble running package.json commands
Trouble running package.json commands

Time:06-08

I am trying to run some commands I wrote in my package.json to test environment variables. However, when I try to run them in the Node.js command prompt, it throws me an error.

My package.json looks like this:

{
  ...
  "scripts": {
    ...
    "dev": "set NODE_ENV=development && node ./server/index.js",
    "prod": "set NODE_ENV=production && node ./server/index.js"
  },
}

And when I try to do npm run dev or npm run prod, it throws me the following:

npm ERR! Missing script: "dev"

so, what am I doing wrong here?

CodePudding user response:

Are you sure you have this directory structure?

|- package.json 
|- server
     |-index.js

If so, try changing path to: "dev": "set NODE_ENV=development && node server/index.js",

  • Related