1

When I run npm start, I get the dreaded "npm ERR! missing script: start"


Already tried changing the "start" line in the package.json in every way shown here and on Google going back a full year.

Also tried installing just about every stable node/npm stable release from the current to 12.x. Deleted yarn just to be sure. Wnet back to current release.

Ran everything from npm init to npm create-react-app [project folder] node_modules are there.

The script for run does show up in the package.json.

Deleted the project directory,deleted the repository and re-cloned the depository fresh.


OS: Linux Mint 19.1 Cinnamon Linux Mint 19.1 is based on Ubuntu 18.04.1 Vs Code 1.37.1 - all extensions disabled.

$ npm -v
6.9.0

$ whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz

$ which npm 
/usr/bin/npm

*******************************************
*package.json*:
{
  "main": "index.js",
  "name": "team-builder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-scripts": "3.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"

  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
  • Note: I've tried every variant of the start script posted here in the past year.

debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose config Skipping project config: /home/mark/.npmrc. (matches 
 userconfig)
5 verbose stack Error: missing script: start
5 verbose stack     at run (/usr/lib/node_modules/npm/lib/run- 
 script.js:155:19)
5 verbose stack     at /usr/lib/node_modules/npm/lib/run- 
 script.js:63:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read- 
  package-json/read-json.js:115:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read- 
 package-json/read-json.js:418:5
5 verbose stack     at checkBinReferences_ 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
 json.js:373:45)
5 verbose stack     at final 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read - 
 json.js:416:3)
5 verbose stack     at then 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
  json.js:160:5)
5 verbose stack     at ReadFileContext.<anonymous> 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
 json.js:3 32:20)
5 verbose stack     at ReadFileContext.callback 
 (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful- 
 fs.js:90:16)
5 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] 
 (fs.js:237:13)
6 verbose cwd /home/mark/OneDrive/Repositories/team-builder
7 verbose Linux 4.15.0-58-generic
8 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
9 verbose node v10.16.3
10 verbose npm  v6.9.0
11 error missing script: start
12 verbose exit [ 1, true ]

I've tried just about everything. I hope you all can help. npm start won't run, so I'm basically coding blind - nothing to the monitor, no Chrome React devTools.

1 Answer 1

2

Your scripts section looks off in your package.json perhaps you can change your start script to the following:

"start": "react-scripts start",

For full reference your scripts section should look similar to this, assuming you're trying to use react bootstrapped with the create-react-app cli:

package.json

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

Hopefully that helps!

Sign up to request clarification or add additional context in comments.

7 Comments

Thanks for the quick response! Yeah, the way it was originally. The last iteration was my last hope for the script. I changed it back just now, and nope... no cigar. I've literally tried every script variant here and on Google - that was my first thought. Still, I really appreciate you reaching out. That helps - it least I know I'm not suffering silently with this dang error!
can you post just your package.json file as you have it currently as well as your entire error stack trace?
Ok, I posted the info up. I included the debug log - I stll had it up. Let me know if there's anything alse you need. Thanks.
remove this line in your package.json: main": "index.js", then try rerunning. Also, what version of create-react-app did you use?
Took your advice there, and was finally coding again. I really appreciate your help. Lesson learned? I took for granted that the OS was bullet-proof. Shouldn't have ruled it out - there are no absolutes in debugging.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.