question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module '@babel/parser'

See original GitHub issue

Description

When running npx react-native init myApp it insalls all dependencies but eventually it will return Error: Cannot find module '@babel/parser'

Version

i dont know. latest i supose

Output of npx react-native info

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module ‘@babel/parser’ Require stack:

  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules\metro\src\Bundler\util.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules\metro\src\Assets.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules\metro\src\Server.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules\metro\src\shared\output\bundle.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli-plugin-metro\build\commands\bundle\buildBundle.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli-plugin-metro\build\commands\bundle\bundle.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli-plugin-metro\build\commands\bundle\index.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli-plugin-metro\build\commands\index.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli-plugin-metro\build\index.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli\build\commands\index.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli\build\index.js
  • C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules@react-native-community\cli\build\bin.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (C:\Users\titul\AppData\Local\npm-cache_npx\7930a8670f922cdb\node_modules\metro\src\Bundler\util.js:12:17) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: ‘MODULE_NOT_FOUND’, requireStack: [ ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\Bundler\util.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\Assets.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\Server.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\shared\output\bundle.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli-plugin-metro\build\commands\bundle\buildBundle.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli-plugin-metro\build\commands\bundle\bundle.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli-plugin-metro\build\commands\bundle\index.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli-plugin-metro\build\commands\index.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli-plugin-metro\build\index.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli\build\commands\index.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli\build\index.js’, ‘C:\Users\titul\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\@react-native-community\cli\build\bin.js’ ] }

Steps to reproduce

run npx react-native init myApp

Snack, code example, screenshot, or link to a repository

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
AXiLiYacommented, Jul 28, 2022

It seems node_modules’s problem. I go to the npx directory in the error log(in my Mac is ~/.npm/_npx/7930a8670f922cdb). And I execute

rm -rf node_modules
rm package-lock.json
npm i

Then it can init project correctly. I hope it’s useful to other who meet this problems.

0reactions
cortinicocommented, Jul 29, 2022

Then it can init project correctly

Closing as the original author is unresponsive + there is a suggested workaround

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module '@babel/parser' - Stack Overflow
{ Error: Cannot find module '@babel/parser' at Function.Module._resolveFilename (module.js:548:15) at Function.Module.
Read more >
@babel/parser - npm
@babel/parser. A JavaScript parser. See our website @babel/parser for more information or the issues associated with this package. Install.
Read more >
How can I solve "Error: Cannot find module '@babel/parser ...
I am new to Vue.js. I tried to create new projet according to tutorials and official Vue/CLI manual. 1) First I ran the...
Read more >
Cannot find module '@babel/core' error [Solved] | bobbyhadz
To solve the error "Cannot find module '@babel/core'", make sure to install the @babe/core package by opening your terminal in your project's root...
Read more >
parsing error: cannot find module 'next/babel' - You.com
next.js - Parsing error : Cannot find module 'next/babel' - Stack ... ... Create file called .babelrc in your root directory and add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found