Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

npm start (react app) gives errors on package.json

Trying to write my first react-app using node:

my command line results in Windows 10 cmd.exe:

C
:\Users\ENDER\Desktop>cd react-app

C:\Users\ENDER\Desktop\react-app>npm start
npm ERR! code EJSONPARSE
npm ERR! path C:\Users\ENDER\Desktop\react-app/package.json
npm ERR! JSON.parse Unexpected token
npm ERR! JSON.parse  in JSON at position 372 while parsing '{
npm ERR! JSON.parse   "name": "react-app",
npm ERR! JSON.parse   "version": "1'
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ENDER\AppData\Local\npm-cache\_logs\2021-05-17T20_43_45_067Z-debug.log

C:\Users\ENDER\Desktop\react-app>

Open in new window

I will be needing on-going help until I can get this demo running.  I can provide LOGS, directory listings, file contents .. whatever you need.


package:json:
{
  "name": "react-app",
  "version": "1",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "node server.js''
    "build": "build",
    "test": "test",
    "eject": "eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
  "main": "index.js",
  "devDependencies": {},
  "author": "",
  "license": "ISC"
}

Open in new window



directory listing of my application folder ( created using npm "create react app"  )
C:\Users\ENDER\Desktop\react-app>dir
 Volume in drive C is WINDOWS
 Volume Serial Number is 7E73-7DF1

 Directory of C:\Users\ENDER\Desktop\react-app

05/16/2021  02:37 PM    <DIR>          .
05/16/2021  02:37 PM    <DIR>          ..
10/26/1985  02:15 AM               310 .gitignore
05/16/2021  02:38 PM    <DIR>          node_modules
05/16/2021  02:38 PM         1,545,392 package-lock.json
05/17/2021  01:00 PM               965 package.json
05/16/2021  02:37 PM    <DIR>          public
10/26/1985  02:15 AM             3,369 README.md
05/16/2021  02:37 PM    <DIR>          src
               4 File(s)      1,550,036 bytes
               5 Dir(s)  631,692,632,064 bytes free

C:\Users\ENDER\Desktop\react-app>

Open in new window

Here is the generated log file indicated at the bottom of the error message:
C:\Users\ENDER\AppData\Local\npm-cache\_logs>notepad 2021-05-16T20_05_17_749Z-debug.log
0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Users\\ENDER\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'start'
0 verbose cli ]
1 info using npm@7.13.0
2 info using node@v13.0.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:C:\Users\ENDER\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 15ms
6 timing config:load:builtin Completed in 15ms
7 timing config:load:cli Completed in 0ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\Users\ENDER\Desktop\TomReactTutorial\React\.npmrc Completed in 0ms
10 timing config:load:project Completed in 0ms
11 timing config:load:file:C:\Users\ENDER\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\ENDER\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 15ms
19 timing npm:load:configload Completed in 15ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 16ms
22 timing npm:load:cleanupLog Completed in 0ms
23 timing npm:load:configScope Completed in 0ms
24 timing npm:load:projectScope Completed in 0ms
25 timing npm:load Completed in 31ms
26 timing config:load:flatten Completed in 16ms
27 timing command:run-script Completed in 16ms
28 timing command:start Completed in 47ms
29 verbose stack Error: Missing script: "start"
29 verbose stack
29 verbose stack Did you mean one of these?
29 verbose stack     npm star # Mark your favorite packages
29 verbose stack     npm stars # View packages marked as favorites
29 verbose stack
29 verbose stack To see a list of scripts, run:
29 verbose stack   npm run
29 verbose stack     at RunScript.run (C:\Users\ENDER\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:99:13)
30 verbose cwd C:\Users\ENDER\Desktop\TomReactTutorial\React
31 verbose Windows_NT 10.0.19041
32 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ENDER\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
33 verbose node v13.0.1
34 verbose npm  v7.13.0
35 error Missing script: "start"
35 error
35 error Did you mean one of these?
35 error     npm star # Mark your favorite packages
35 error     npm stars # View packages marked as favorites
35 error
35 error To see a list of scripts, run:
35 error   npm run
36 verbose exit 1


Open in new window

Avatar of Tom Knowlton
Tom Knowlton
Flag of United States of America image

ASKER

UPDATE:

Finally found this gem:

npm config script-shell powershell

and the webserver started up!  I guess changing the script shell helped with my path not specified issue.

But now I get:

Failed to compile.

./src/App.js
  Line 6:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 7:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 8:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 9:    'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 10:  'React' must be in scope when using JSX  react/react-in-jsx-scope
  Line 12:   'React' must be in scope when using JSX  react/react-in-jsx-scope

Search for the keywords to learn more about each error.

Open in new window

UPDATE to my last UPDATE:

After fixing the import line for App.js:

import React from 'react''

It ran just fine:

User generated image

This page helped a lot:

https://stackoverflow.com/questions/39190164/npm-the-system-cannot-find-the-path-specified
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The site has really changed since I last made consistent use of it.  How do I submit my own answer as the solution?

I don't necessarily want to do that for this post, but going forward.

Thanks Julian!

Tom
I am assuming you found the errors in your package.json file - it was not valid JSON 

Yup, just as you said.