Home > OS >  NPM Start stop working in VSCode REACT Development
NPM Start stop working in VSCode REACT Development

Time:11-13

Wow..this has stopped my development. NPM START and F5 Debug stopped working. Index.html exists in PUBLIC. I included the contents of index.html below. I am in a Windows environment. Displays: ...

Could not find a required file.
  Name: index.html
  Searched in: C:\React-Springboot-CRUD-App\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-frontend@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1

... Getting this in the log. Line 8 has a wierd path that is underlined in the error log: ...

C:\React-Springboot-CRUD-App\node_modules\.bin;

...

So what is the fix? Where is this path defined?

...

    0 info it worked if it ends with ok
    1 verbose cli [
    1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node.exe',
    1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
    1 verbose cli   'start'
    1 verbose cli ]
    2 info using npm@6.14.13
    3 info using node@v14.17.0
    4 verbose run-script [ 'prestart', 'start', 'poststart' ]
    5 info lifecycle react-frontend@0.1.0~prestart: react-frontend@0.1.0
    6 info lifecycle react-frontend@0.1.0~start: react-frontend@0.1.0
    7 verbose lifecycle react-frontend@0.1.0~start: unsafe-perm in lifecycle true
    8 verbose lifecycle react-frontend@0.1.0~start: PATH: C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\React-Springboot-CRUD-App\node_modules\.bin;C:\Python39\Scripts\;C:\Python39\;C:\Program Files\ImageMagick-7.0.8-Q16;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Rob.Sobol\AppData\Local\Microsoft\WindowsApps;
C:\Users\Rob.Sobol\.dotnet\tools;C:\Users\Rob.Sobol\AppData\Roaming\npm;C:\Users\Rob.Sobol\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Users\Rob.Sobol\AppData\Local\GitHubDesktop\bin
    9 verbose lifecycle react-frontend@0.1.0~start: CWD: C:\React-Springboot-CRUD-App
    10 silly lifecycle react-frontend@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
    11 silly lifecycle react-frontend@0.1.0~start: Returned: code: 1  signal: null
    12 info lifecycle react-frontend@0.1.0~start: Failed to exec start script
    13 verbose stack Error: react-frontend@0.1.0 start: `react-scripts start`
    13 verbose stack Exit status 1
    13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
    13 verbose stack     at EventEmitter.emit (events.js:376:20)
    13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
    13 verbose stack     at ChildProcess.emit (events.js:376:20)
    13 verbose stack     at maybeClose (internal/child_process.js:1055:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    14 verbose pkgid react-frontend@0.1.0
    15 verbose cwd C:\React-Springboot-CRUD-App
    16 verbose Windows_NT 10.0.19041
    17 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
    18 verbose node v14.17.0
    19 verbose npm  v6.14.13
    20 error code ELIFECYCLE
    21 error errno 1
    22 error react-frontend@0.1.0 start: `react-scripts start`
    22 error Exit status 1
    23 error Failed at the react-frontend@0.1.0 start script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 1, true ]

...

context of index.html ...

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>React App</title>
  <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA 058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
  
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>

...

CodePudding user response:

Well I navigated to the correct subdirectory, re-installed some packages, ran NPM AUDIT FIX and it eventually started working again. Partly common sense, partly voodoo/

CodePudding user response:

I saw that it eventually started working, but I just want to add here that you can use npx start instead of npm start.

  • Related