问题描述
我什么都试过了。在 Windows 10 中查看“PATH”变量
-重新安装节点多次和多个版本 - 从程序文件夹和 AppData 和用户文件夹中删除了所有节点文件和 npm 文件。 - 我终于让 react 应用程序可以工作了,但是当我每次执行“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>
I have deleted the node_modules folder and the package-lock.json and done 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