realm-js: Errors running npm install on Windows, missing files?

Trying to use Realm in my React Native app on Windows 10. The output is pasted below. It seems like it’s missing the realm pre built stuff for my node version?

Node: 6.9.1 npm: 3.10.8 (React Native: 0.37)

c:\code\ReduxNavigation>npm install realm --save

> realm@0.15.0 install c:\code\ReduxNavigation\node_modules\realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/realm-v0.15.0-node-v48-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for realm@0.15.0 and node@6.9.1 (node-v48 ABI) (falling back to source compile with node-gyp)

c:\code\ReduxNavigation\node_modules\realm>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node "" clean )

c:\code\ReduxNavigation\node_modules\realm>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64\realm.node --module_name=realm --module_path=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64 )  else (node "" configure --fallback-to-build --module=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64\realm.node --module_name=realm --module_path=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64 )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1988, in GenerateOutput
    generator_flags))
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 927, in _GenerateProject
    return _GenerateMSVSProject(project, options, version, generator_flags)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1028, in _GenerateMSVSProject
    _AddAccumulatedActionsToMSVS(p, spec, actions_to_add)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 468, in _AddAccumulatedActionsToMSVS
    cmd=command)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 438, in _AddCustomBuildToolForMSVS
    _ConfigFullName(config_name, c_data), tools=[tool])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSProject.py", line 181, in AddFileConfig
    raise ValueError('AddFileConfig: file "%s" not in project.' % path)
ValueError: AddFileConfig: file "..\..\binding.gyp" not in project.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=c:\\code\\ReduxNavigation\\node_modules\\realm\\compiled\\node-v48_win32_x64\\realm.node" "--module_name=realm" "--module_path=c:\\code\\ReduxNavigation\\node_modules\\realm\\compiled\\node-v48_win32_x64"
gyp ERR! cwd c:\code\ReduxNavigation\node_modules\realm
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64\realm.node --module_name=realm --module_path=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (c:\code\ReduxNavigation\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "c:\\code\\ReduxNavigation\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd c:\code\ReduxNavigation\node_modules\realm
node-pre-gyp ERR! node -v v6.9.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64\realm.node --module_name=realm --module_path=c:\code\ReduxNavigation\node_modules\realm\compiled\node-v48_win32_x64' (1)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "realm" "--save"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! realm@0.15.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the realm@0.15.0 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the realm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs realm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls realm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\code\ReduxNavigation\npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 6
  • Comments: 23 (4 by maintainers)

Most upvoted comments

The following works for me on Windows 10 (Installing Realm 0.14.3 with Node@7.2.0 and React Native 0.39)

  1. Install the older version in the project folder npm install --save realm@0.14.3

  2. Open node_modules/realm/package.json and remove this line: "postlink": "node_modules/realm/scripts/rnpm-postlink.js"

  3. Link react-native link realm

  4. Try your first component

import Realm from 'realm';

export default class TestProject extends Component {
  render() {     
    
	// Realm.clearTestState(); // Uncomment to drop/recreate database
	
	let realm = new Realm({
		schema: [{name: 'Dog', properties: {name: 'string'}}]
	});

   realm.write(() => {
     realm.create('Dog', {name: 'Rex'});
   });
   
   return (
     <View style={styles.container}>
       <Text style={styles.welcome}>
         Count of Dogs in Realm: {realm.objects('Dog').length}
       </Text>
     </View>   
    );
  }
}

DISCLAIMER: I don’t recommend avoiding the post link step for production apps (just use a mac), but this at least will enable someone to get Realm working with Windows so they can play around with it until Windows is supported by the Realm install tools.

any idea when the changes will be available via npm

the solution is to use node < 7. I use 6.9.5 now my project works very well

Got the same problem. OS: linux 16.04 App: react native app (react 16.2, react-native 0.52)

node-pre-gyp info check checked for "/home/james/react_native/app/node_modules/realm/compiled/node-v64_linux_x64/realm.node" (not found)
node-pre-gyp http GET https://static.realm.io/node-pre-gyp/2.12.0/realm-v2.12.0-node-v64-linux-x64.tar.gz
node-pre-gyp http 404 https://static.realm.io/node-pre-gyp/2.12.0/realm-v2.12.0-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/2.12.0/realm-v2.12.0-node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for realm@2.12.0 and node@10.3.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 

Awesome job!

@kristiandupont Fair enough. I will probably dust off my old mac if I can’t find a solution that looks as good as Realm does. Good luck fixing the issues, cheering for you guys.