Home > database >  I cant install node modules in react native ,and I get a error message, how can i fix this?
I cant install node modules in react native ,and I get a error message, how can i fix this?

Time:01-10

After installing some packages I stumbeled against this error, and I dont know how to fix this: I hope someone knows how to get this cleaned up, I dont care if I have to install all the packages again.

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\muziek\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\muziek\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > @expo/[email protected] prepare
npm ERR! > expo-module prepare && npm run generate-lazy && npm run copy-vendor
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated [email protected]: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm ERR! npm WARN deprecated [email protected]: Critical bug fixed in v2.0.1, please upgrade to the latest version.
npm ERR! npm WARN deprecated [email protected]: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm ERR! npm WARN deprecated [email protected]: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm ERR! npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm ERR! npm WARN deprecated [email protected]: this library is no longer supported
npm ERR! npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm ERR! npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm ERR! npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm ERR! npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm ERR! npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated [email protected]: use String.prototype.padStart()
npm ERR! npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm ERR! npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated [email protected]: 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 ERR! npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! npm WARN deprecated [email protected]: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! C:\Users\muziek\AppData\Local\npm-cache\_cacache\tmp\git-clone9p2w60\node_modules\expo-module-scripts\bin\expo-module-prepare:3
npm ERR! set -eo pipefail
npm ERR!         ^^^^^^^^
npm ERR!
npm ERR! SyntaxError: Unexpected identifier
npm ERR!     at Object.compileFunction (node:vm:352:18)
npm ERR!     at wrapSafe (node:internal/modules/cjs/loader:1031:15)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1065:27)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:17:47
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\muziek\AppData\Local\npm-cache\_cacache\tmp\git-clone9p2w60
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c expo-module prepare && npm run generate-lazy && npm run copy-vendor
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\muziek\AppData\Local\npm-cache\_logs\2023-01-09T08_48_36_983Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\muziek\AppData\Local\npm-cache\_logs\2023-01-09T08_48_13_969Z-debug-0.log

CodePudding user response:

Try deleting the node_modules directory and running npm install again. This will force npm to reinstall all of the dependencies, which might fix the problem.

If that doesn't work, you might want to try deleting the package-lock.json file and running npm install again.

If none of these steps help, you can try running npm install --force. However, using the --force flag can also cause problems if it causes npm to overwrite or delete files that are needed for your project to work correctly. It's generally a good idea to use the --force flag only as a last resort, after other methods of fixing the problem have been tried.

CodePudding user response:

Try this,

  1. run npm cache clean --force

  2. Delete node_modules like $ rm -rf node_modules also delete package-lock.json

  3. Install fresh packages npm install

  4. Start the application npm start

Let us know your feedback. Thanks

  • Related