Neko
Neko

Reputation: 589

sh: SET: command not found in `npm start`

I'm trying to run a react project . and after I run command : npm start , it gave me an error:

sh: SET: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `SET PORT=3100 && node scripts/start.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jzhu321/.npm/_logs/2019-04-22T09_29_51_770Z-debug.log

and I have found the config here in package.json :

  "scripts": {
    "start": "SET PORT=3100 && node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js"
  },

How do I fix this problem?

Upvotes: 14

Views: 20494

Answers (2)

Lameck Meshack
Lameck Meshack

Reputation: 7073

Change SET to set your code should be

 "scripts": {
"start": "set PORT=3100 && node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},

Removing the set command will also result in error sh: 1: PORT: not found if there are spaces so you can use PORT=3100

Upvotes: 6

Thanh Nguyen Van
Thanh Nguyen Van

Reputation: 11842

Shell script doesnot have SET command, just had: set

it should be :

"start": "set PORT=3100 && node scripts/start.js",

Upvotes: 28

Related Questions