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.

Errors running npm install on Windows, missing files?

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

15reactions
EricCarrGHcommented, Dec 3, 2016

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.

8reactions
ghostcommented, Dec 21, 2016

any idea when the changes will be available via npm

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common errors | npm Docs
Some strange issues can be resolved by simply running npm cache clean and trying again. · If you are having trouble with npm...
Read more >
What could cause an error related to npm not being able to ...
In my case I tried to run npm i firebase@7.8.2 and got the error because the dev server was running in another terminal...
Read more >
NodeJS - npm install errors on Windows - YouTube
NOTE: If you are using Windows 10, you will want to open an Administrator PowerShell (right-click and choose " Run as administrator").
Read more >
NPM install error - Material Design for Bootstrap
Trying to install MDB pro 4.19.2 just downloaded and ran npm install but getting this error of sha512 not matching. Can someone tell...
Read more >
Getting a lot of errors when running npm install - Treehouse
If you can't get it to run I would just manually install all the modules. That way you can figure out which one...
Read more >

github_iconTop Related Medium Post

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