I have a specific requirement to use react native for creating app for windows devices using the UWP. I googled about react native for windows with UWP support then i followed https://github.com/ReactWindows/react-native-windows
my
NPM version: 2.15.9
Node version: 4.6.1
commands i followed:
choco install nodejs.install
npm install -g react-native-cli
react-native init AwesomeProject
cd AwesomeProject
npm install --save-dev rnpm-plugin-windows
react-native windows
then i got the below error
E:\reactApps\myapp\sample1>react-native windows
E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-core\lib\transformation\file\options\option-manager.js:176
throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
^
ReferenceError: Unknown plugin "transform-flow-strip-types" specified in "base" at 0, attempted to resolve relative to "E:\reactApps\myapp\sample1\node_modules\react-native-windows\local-cli"
at E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-core\lib\transformation\file\options\option-manager.js:176:17
at Array.map (native)
at Function.normalisePlugins (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-core\lib\transformation\file\options\option-manager.js:154:20)
at OptionManager.mergeOptions (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-core\lib\transformation\file\options\option-manager.js:228:36)
at OptionManager.init (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-core\lib\transformation\file\options\option-manager.js:373:12)
at compile (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-register\lib\node.js:103:45)
at loader (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-register\lib\node.js:144:14)
at Object.require.extensions.(anonymous function) [as .js] (E:\reactApps\myapp\sample1\node_modules\react-native\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
React native ref
The issue is related to the version of NPM that you are using. You should be using at least npm#3.*. Try upgrading with npm upgrade npm#latest.
After that, you'll want to remove the node_modules folder and re-run npm install in your project directory.
Related
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
Error: spawn ENOTDIR
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:757:9)
at spawn (/Users/ni/Desktop/WORK/RET/LEAING/ToGo/.yarn/cache/cross-spawn-npm-6.0.5-2deab6c280-f893bb0d96.zip/node_modules/cross-spawn/index.js:12:24)
at run (/Users/ni/Desktop/WORK/RET/LEAING/ToGo/.yarn/unplugged/expo-npm-47.0.13-9da3537782/node_modules/expo/bin/cli.js:11:12)
at Object. (/Users/ni/Desktop/WORK/RET/LEAING/ToGo/.yarn/unplugged/expo-npm-47.0.13-9da3537782/node_modules/expo/bin/cli.js:6:1)
at Module._compile (node:internal/modules/cjs/loader:1226:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
at require$$0.Module._extensions..js (/Users/ni/Desktop/WORK/RET/LEAING/ToGo//.pnp.cjs:21020:33)
at Module.load (node:internal/modules/cjs/loader:1089:32)
at require$$0.Module._load
(/Users/ni/Desktop/WORK/RET/LEAING/ToGo//.pnp.cjs:20839:22) {
errno: -20,
code: 'ENOTDIR',
syscall: 'spawn'
}
node version : v18.14.0
npm version: 9.4.1
yarn version: 3.4.1
expo version: WARNING: The legacy expo-cli does not support Node +17. Migrate to the versioned Expo CLI (npx expo).
6.3.0
React Native version: 0.71
Thank you in advance.
If i try using npm it works (npx create-expo-app AwesomeProject),
but I want to use yarn.
Try updating the expo CLI to a version that is compatible with Node version 18.14.0 by running the command "npx expo".
Not able to install detox by npm install or yarn.
yarn add --dev detox will fail out in the postbuild.js`
This question is in response to wix/detox's policy regarding issue tracking:
https://github.com/wix/Detox/issues/1523
Followed the latest tutorial to get started with detox.
react-native init example // (0.60.4)
brew update
brew tap wix/brew
brew install applesimutils
yarn global add detox-cli // you shouldn't need this
yarn add --dev detox // add this package in /example app
Installing detox will exit out with a childprocess error.
Error:
Command Failed: <YOUR_PROJECT_PATH>/node_modules/detox/scripts/build_framework.ios.sh
at checkExecSyncError (child_process.js:629:11)
at Object.execFileSync (child_process.js:647:13)
at Object.<anonymous> (<YOUR_PROJECT_PATH>/node_modules/detox/scripts/postinstall.js:2:27)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Followed their guide here:
https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md
UPDATE: See the solution below, was able to get detox installed without an issue.
The detox version that was previously installed required the Legacy Build System
How to upgrade correctly:
Remove ~/Library/Detox/
Remove ~/Library/Developer/Xcode/DerivedData/*
yarn add -D detox // installs without and issue
How did this issue occur:
If you have a previous version of Detox installed which relied on an earlier Xcode you will get a conflict between Legacy & New Build System.
Detox will then look at your ~/Library/Detox data and fail to build due to New Build System being selected as default
I resolved this install error by doing the following:
In xcode 10.3 go into File > Workspace Settings
Under Shared Workspace Settings select Legacy Build System
Re-install detox (it will not use the legacy build and not error out)
I am creating a new react-native project using :
react-native init {proj_name}
But I am getting the following error.
D:\Reactnative\Project\{proj_name}\node_modules\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Module._compile (D:\Reactnative\Project\Learnwizz\node_modules\pirates\lib\index.js:91:24)
at Module._extensions..js (module.js:654:10)
at Object.newLoader [as .js] (D:\Reactnative\Project\Learnwizz\node_modules\pirates\lib\index.js:96:7)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
This is a known bug right now with react-native 0.56 when running on Windows (see here and here).
Until it is fixed, you can work around the issue by explicitly specifying an older version of react-native when running react-native init. E.g.
react-native init {proj_name} --version react-native#0.55.4
EDIT: As a temporary workaround, you can init your project with the previous version of RN using react-native init --version="0.55.4" {projectName}
I'm also running into this exact error today. I just now noticed react-native init is now using react-native 0.56 which was just release a few hours ago I believe.
This might give you some troubleshooting ideas.
Currently I am getting Exception in latest version that is 0.56 (React Native) and not able to run the code in emulator, However I have downgraded React native version to 0.55.4, then it is working for me..
Run Below line of command :
react-native init {project_name} --version react-native#0.55.4
Yes, with new version of react-native , typescript code in react-cli has some issue , but don't worry
go to app folder
hit command
npm uninstall react-native --save
npm install react-native#0.55.4 --save
will solve your problem !!
in windows 10 update node.js to version 14.18.1
https://nodejs.org/dist/v14.18.1/node-v14.18.1-x64.msi
I started a react-native project with 'react-native init' and was created without errors, however, when I used the command 'react-native run-android' in the project directory this is what I got:
throw er
^
Error: EIO: i/o error, read
at Object.fs.readSync (fs.js:675:18)
at Object.readSync (D:\myProjects\react-native\ReactTodoApp\node_modules\graceful-fs\polyfills.js:138:28)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:575:19)
at Object.Module._extensions..js (module.js:645:20)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18).
The same error appears although that android emulator is running or an android device connected, all the same.
I need to know what is the solution to this.
I am using react-native 0.50.3, react-native-cli 2.0.1.
Seems like a Node related error.
Try restarting Node server. Node cannot read polyfills.js. This can happen if multiple command instances are running in same directory at same time.
Sometimes cleaning cache works
Updating or reinstalling react native is a suggested fix.
You could uninstall react-native and then use the following command:
npm install react#reactversion --save.
Note (reactversion) is your desired version you want to have.
You could also just try reinstalling it as:
npm install react --save
Or upgrade with:
npm update react-native
react-native init AwesomeProject is throwing SyntaxError: Unexpected token : and I'm not sure why. I've uninstalled and re-installed react-native-cli. Tried with and without yarn. Any suggestions?
mes-MBP:myproject me$ react-native init AwesomeProject
This will walk you through creating a new React Native project in /Users/me/WebstormProjects/myproject/AwesomeProject
Using yarn v0.17.10
Installing react-native...
/Users/me/WebstormProjects/myproject/AwesomeProject/node_modules/react-native/local-cli/util/Config.js:43
cwd: string,
^
SyntaxError: Unexpected token :
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at loader (/Users/me/WebstormProjects/myproject/AwesomeProject/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/me/WebstormProjects/myproject/AwesomeProject/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/me/WebstormProjects/myproject/AwesomeProject/node_modules/react-native/local-cli/cliEntry.js:13:16)
at Module._compile (module.js:413:34)
Looks like the error an update was published to react-native. Others are experiencing the same issue so I'm going to answer this and say it's a package issue. https://github.com/facebook/react-native/issues/11384
Until this gets resolved, you can use rninit(https://www.npmjs.com/package/rninit) to install using the previous version of react-native. This worked for me:
rninit init mobile --source react-native#0.39.0
Update node version on OS.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Apparently the new version React Native 0.56.0 has this problem.
To fix this problem, you can install the previous version.
react-native init --version="0.55.0" MyNewApp