command
npx react-native init gonative
I ran this command in root terminal (parrot linux) and encountered with error.
It says cannot find module 'metro/src/shared/output/bundle'
Node version : v17.3.0
npm version: 8.3.0
npx version : 8.3.0
output
Need to install the following packages:
react-native
Ok to proceed? (y) y
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'metro/src/shared/output/bundle'
Require stack:
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js
- /root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js
- /root/.npm/_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:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js:64:22)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/buildBundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/bundle.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/bundle/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli-plugin-metro/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js',
'/root/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/bin.js'
]
}
Remove global react-native installer
npm uninstall -g react-native-cli #react-native-community/cli
Install metro bundler
npm install --save-dev metro metro-core
Close all terminal/shell, and then run your command again
Related
OS-ubuntu
IDE-VS-Code
npx create-react-app was working fine,I wanted to work on a personal project when i run in to a suggestion that Create React App requires Node 14 or higher. I tried updating node using the following commands sudo npm cache clean -f and then sudo npm install -g n then i ran sudo n stable the following was installed installed : v16.13.1 (with npm 8.1.2).When i tried running npx create-react-app I got the following error
Error: Cannot find module 'libnpx'
Require stack:
- /usr/share/npm/bin/npx-cli.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> (/usr/share/npm/bin/npx-cli.js:3:13)
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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/share/npm/bin/npx-cli.js' ]
}
What i tried after getting the error,
The solution below;
React: create-react-app fails with error "Cannot find module 'lodash'"
How do I approach resolving this problem so that I can get started with my personal project and learning the framework?
Restart your terminal after updating node version.
Restarted vs-code and it started working fine.Hope this helps someone facing the same error
While I was compiling the code using npm start an error occurred.
I create the Axios Instance by running npm install --save axios , but after that i run yarn start its not running.strong text
Here is the error log:
yarn run v1.22.4
$ node scripts/start.js
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module 'resolve'
Require stack:
- /home/falguni/Documents/the_burger_builder/config/webpack.config.js
- /home/falguni/Documents/the_burger_builder/scripts/start.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/falguni/Documents/the_burger_builder/config/webpack.config.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/falguni/Documents/the_burger_builder/config/webpack.config.js',
'/home/falguni/Documents/the_burger_builder/scripts/start.js'
]
}
error Command failed with exit code 1.
This is showing in my terminal and it is not running the server.
Capitalize your folder names and js file names.
try
yarn add axios
instead of
npm install axios
I am not clear but i think this will work
Hi React native masters,
I am trying to create react native app using expo cli.
1-I installed expo globally by:
npm install -g expo-cli
2-Then I checked the version:
expo --version
It showed :6.13.1
3-Then I tried to initiate the app by:
expo init myApp
and it gives me this error:
internal/modules/cjs/loader.js:964
throw err;
^
Error: Cannot find module 'semver'
Require stack:
- C:\Users\Faizan\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:961:17)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:854:27)[39m
[90m at Module.require (internal/modules/cjs/loader.js:1023:19)[39m
[90m at require (internal/modules/cjs/helpers.js:72:18)[39m
at Object.<anonymous> (C:\Users\Faizan\AppData\Roaming\npm\node_modules\[4mexpo-cli[24m\bin\expo.js:4:14)
[90m at Module._compile (internal/modules/cjs/loader.js:1128:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:983:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:891:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: [
[32m'C:\\Users\\Faizan\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'[39m
]
}
Please help me out in this, Thanks!
npm install -g expo-cli --force
try this it's work for me
I am pleased to announce the solution to my challenge.
I actually used it in powershell and got expo-cli installed globally in my machine
npm install --global expo-cli
I am beginner in React.js and tried many tutorials for seting up the environment for React.js!!
first it came
The CLI moved into a separate package: webpack-cli. Please install
'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D module.js:472
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (F:\ReactJs\FirstReact\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
then i run the :
npm install webpack-cli
and then i get this error below several trying may tutorials
ERROR in multi (webpack)-dev-server/client?http://localhost:8080
(webpack)/hot/dev-server.js ./src Module not found: Error: Can't
resolve './src' in 'F:\ReactJs\FirstReact' # multi
(webpack)-dev-server/client?http://localhost:8080
(webpack)/hot/dev-server.js ./src main[2]
the problem is in your webpack.config.js , please check with typo with (module.export). it should (module.exports)
I am trying to run a test with react/jest. When I do npm test /jest, I am getting the following error:
> # test /Users/suparnasoman/Downloads/create-react-app-master
> node packages/react-scripts/scripts/test.js --env=jsdom
module.js:471
throw err;
^
Error: Cannot find module 'jest'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/suparnasoman/Downloads/create-react-app-master/packages/react-scripts/scripts/test.js:26:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Test failed. See above for more details.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Check if the npm package is installed successfully.
If the installation is successful check if it is installed globally/locally.
If local, you might need to provide the absolute path node_modules/bin/jest
It seems the jest module is missing, did you try npm --save install jest, or npm install as Chase mentioned?