npm - 在“create-react-app”之后“npm start”将不起作用
问题描述
我已经尝试了一切。查看 Windows 10 中的“PATH”变量
- 多次重新安装节点和多个版本 - 从程序文件夹以及 AppData 和用户文件夹中删除所有节点文件和 npm 文件。- 我终于让反应应用程序工作了,但是当我每次执行“npm start”时,它都会给我错误。
-我也删除了节点模块和 package-lock.json 文件,但仍然没有解决方案。
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1> npm start
> maryam1@0.1.0 start
> react-scripts start
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Imran\Desktop\zertomastery\19_react\maryam1
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Imran\AppData\Local\npm-cache\_logs\2021-07-18T18_17_31_571Z-debug.log-debug.log
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1>
我已经删除了 node_modules 文件夹和 package-lock.json 并完成了 npm install
- 删除 node_modules 和 package.json 后 npm install 的结果。
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1> npm start > npm install
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has
been deprecated and is no longer supported or maintained act\maryam1
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.co find a file.om/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.1: The querystring
API is considered Legacy. new code should use the URLSearchParams API instead. 18_17_31_571Z-debug.log
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will bregs\2021-07-18Tak on node v14+. Upgrade to chokidar 3 with 15x less dependencies. >
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.0: The querystring
API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm
install @sideway/address'
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random()
in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random()
in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated @hapi/hoek@8.5.1: This version has
been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no
longer maintained and not recommended for usage due to
the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a
slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of
core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\core-js
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Imran\AppData\Local\npm-cache\_logs\2021-07-18T18_22_24_801Z-debug.log
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1
在执行了许多命令和事情之后,当执行“npm start”时我没有得到这个,我切换到 bash
Imran@DESKTOP-3331IKE MINGW64 ~/Desktop/zertomastery/19_react/maryam1 (main)
$ npm start
> maryam1@0.1.0 start
> react-scripts start
node:internal/modules/cjs/loader:355
throw err;
^
Error: Cannot find module 'C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\loader-runner\lib\LoaderRunner.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:347:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:560:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:913:27)
at Function.Module._load (node:internal/modules/cjs/loader:772:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\webpack\lib\NormalModule.js:16:36)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\Imran\\Desktop\\zertomastery\\19_react\\maryam1\\node_modules\\loader-runner\\package.json',
requestPath: 'loader-runner'
}
Imran@DESKTOP-3331IKE MINGW64 ~/Desktop/zertomastery/19_react/maryam1 (main)
$
解决方案
尝试这个,
npm cache clean
npm install
npm start
推荐阅读
- excel - 转置表格和数据
- scripting - 在文件中附加一个字符串变量
- php - 如何使用 lastinsertid() 函数
- android - 使用android约束布局2.0.0 Flow将项目放置一行
- php - 消息:非法字符串偏移量从 Codeigniter2x 版本升级到 Codeigniter 3x 版本
- c++ - 使用 Poco:Condition 唤醒两个线程
- c++ - 如何在安装了 Visual Studio 2017 的 Windows 10 上使用第三方实用程序(包括 swiftshader 和 node 和 node_modules)构建 CEF
- azure - 无法在我使用 Graph API 获得的 Azure AD 应用程序列表中检索我的应用程序之一
- here-api - 匹配路由 API 的 KML 示例
- react-native - 发出一个事件会导致其他事件在本机反应中触发