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)
Related
react-native start command gives error.Genrated error is given below. Please help me.
react-native start
/usr/lib/node_modules/react-native/local-cli/server/checkNodeVersion.js:43
);
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/react-native/local-cli/cli.js:17:1)
I found out that if you have installed nvm to manage different node versions, is showing one version but using another from behind, I also have problems with my global brew node installation, so I had reinstalled again from scratch. As a general tip, unload the nvm and work with the npm global installation.
Update your nodejs should fix
sudo npm cache clean -f (force) clear you npm cache
sudo npm install -g n install "n" (this might take a while)
sudo n stable upgrade to lastest version
I checked the file "/usr/lib/node_modules/react-native/local-cli/server/checkNodeVersion.js:43" and found that "React Native runs on Node 8.0 or newer."
But my node vesion was 6.0 ,so that the problem.
The error belongs with node js version.
node --v in cmd will show version less than 8.
Update your node version by installing nvm. This will help you update version.
https://stackoverflow.com/a/7718438/9090200
In-case you are using nvm to install a new version of node.
It's important that you will use nvm alias default node so it will be the default version while opening new shells.
React Native runs on Node 8.0 or newer
If you are using nvm then set "nvm alias default >=8.X.X" like "nvm alias default 8.0.0"
Re-open your terminal and try it again.
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
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.
I am trying to use the Aurelia-cli tool to create a new Aurelia project. I am using a Windows 10 machine with node and git installed.
I created a new empty folder for the project, and opened a command prompt and navigated to this folder.
I then ran the following command which completed successfully:
npm install -g aurelia-cli
Then I ran the following to create a new project:
au new
But this gave the following error:
C:\Users\xxxx\AppData\Roaming\npm\node_modules\aurelia-cli\bin\aurelia- cli.js:3
const resolve = require('../lib/resolve');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Any ideas as to what would be causing this?
Make sure you have a compatible version of Node installed. You can check the your Node version with node -v.
Aurelia CLI is only compatible with Node >= 4.x
You can download a compatible version of Node from here.
This error was to do with the node version but it was not a process of simply downloading and installing the latest version. I got this working after going through the following steps:
Open the Node command prompt and upgrade the node version with:
npm cache clean
npm update -g
Still in the Node command prompt, go to the relevant directory and run
au new
And it worked fine.
Even after upgrading the node version as above, the version had not changed in the normal windows command prompt and the aurelia cli command still did not work from there. So this problem seems to be to do with node versions, windows, and my setup, rather than with the aurelia cli.
The problem
Open react native issue here
I have researched this error extensively (~ 2days dev time) but somehow still no resolution - I have run previous React Native setups fine and thought this might resolve as a final step (see the end of issue).
In short, when I run react-native run-ios from example "AwesomeProject" directory I get the below error in the React Packager launchPackager.command window.
~/AwesomeProject2/node_modules/react-native/packager ~
/Users/alexanderhandy/AwesomeProject2/node_modules/react-native/local-cli/cli.js:74
const setupEnvScript = /^win/.test(process.platform)
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
My setup
Macbook Pro 2012 - OS X 10.11 El Capitan
Xcode (v7.2.1)
Node (v5.7.0) and NVM (0.31.0)
React Native (v0.20.0)
Steps
Upgraded laptop to El Capitan (as per version above) - hadn't used much for last 6 months so was coming back to run some setup
Attempted react native setup and got an error running homebrew when tried to install. Found some unexpected changes to many files when ran git status -- so went into the relevant usr/local homebrew directory and ran git fetch; git reset --hard origin/master
Updated Xcode to over v7 (as per version above)
Installed nvm and latest node to address error warning from Node - note: for some reason have to run . ~/.nvm/nvm.sh in terminal to get nvm working, when I don't v5.7.0 becomes v0.12.4. I have double-checked node is v5.7.0 when error runs
Finally got through to actually building an app when ran react-native init AwesomeProject which completed but hanged for like 10 mins
Ran react-native run-ios and got error and tried to add source ~/.bash_profile to node_modules/react-native/packager/react-native-xcode.sh as suggested here
Considered going back to Ionic so went through their setup again and that wouldn't work either
Tried not to throw my laptop out the window
I had the same problem when creating my project from react-native init command. What I did to get a successful build was do npm install babel and then finally do react-native run-ios. Hope this helps.
this is the issue of Community CLI
kindly add it properly else remove it from your package.json and run your project from xcode it would help
(https://github.com/react-native-community/cli)
when you start a react native project with react-native init MyProject it doesn't add few things globally so we use npx react-native init MyProject.