reactjs - NPM Start 停止在 VSCode REACT 开发中工作
问题描述
哇..这阻止了我的发展。NPM START 和 F5 Debug 停止工作。Index.html 存在于 PUBLIC 中。我在下面包含了 index.html 的内容。我在 Windows 环境中。显示:...
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
...在日志中得到这个。第 8 行有一条奇怪的路径,在错误日志中带有下划线:...
C:\React-Springboot-CRUD-App\node_modules\.bin;
...
那么解决方法是什么?这条路径在哪里定义?
...
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 ]
...
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/bootstrap@4.5.3/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>
...
解决方案
好吧,我导航到了正确的子目录,重新安装了一些软件包,运行了 NPM AUDIT FIX,它最终又开始工作了。部分常识,部分巫术/
推荐阅读
- c - Openssl 1.1.1 库在自签名签名上出现错误
- python - 如何使用 RL 代码中的嵌套 if 向量化 for 循环?
- spring - Jackson ObjectWriter 仅从流中写入第一个条目
- php - 在 PHP 中,是否编写一个没有赋值的变量(已经实例化并设置为一个值)是一个语法上有效的语句?(例如。$My_Variable;)
- amazon-web-services - CDK 传递步骤:如何在输入对象的根目录添加属性
- python - 如何定义平面以获得平面和射线之间的交点?
- svg - 脱机时工作箱不工作,一些 .svg 图标导致 net::ERR_INTERNET_DISCONNECTED
- pandas - 将数据框列索引设置为其他列的最有效方法
- azure - 从 Spring mvc 应用程序的已安装卷中读取秘密值
- html - 在asp.net中自动回发时如何避免引导模式消失