Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dependencies #2259

Closed
arnebr opened this issue Feb 27, 2019 · 21 comments · Fixed by #2277
Closed

Missing dependencies #2259

arnebr opened this issue Feb 27, 2019 · 21 comments · Fixed by #2277
Assignees

Comments

@arnebr
Copy link

arnebr commented Feb 27, 2019

Goals

Try to run and build the new version 2.24.0.

Expected Results

The build process should download the new coca and decompress and unzip it.

Actual Results and Workaround

The packages "decompress" and "https-proxy-agent" are missing.

Error: Cannot find module 'https-proxy-agent'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/ProjectPath/node_modules/realm/scripts/download-realm.js:25:25)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Command PhaseScriptExecution failed with a nonzero exit code

It works if you do

yarn add decompress
yarn add https-proxy-agent

Steps to Reproduce

Try to install the new version.

Version of Realm and Tooling

  • Realm JS SDK Version: 2.24.0
    React Native Environment Info:
    System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
    Memory: 31.00 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
    Binaries:
    Node: 10.11.0 - /usr/local/bin/node
    Yarn: 1.3.2 - ~/.yarn/bin/yarn
    npm: 6.8.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
    iOS SDK:
    Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
    API Levels: 22, 23, 25
    Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.1, 25.0.2
    System Images: android-22 | Google APIs Intel x86 Atom, android-23 | ARM EABI v7a
    IDEs:
    Android Studio: 3.0 AI-171.4443003
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
    react: 16.6.3 => 16.6.3
    react-native: 0.58.5 => 0.58.5
    npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-camera: 0.8.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7
@shenjunru
Copy link

Also these should be dependencies not devDependencies: (required in scripts/download-realm.js)

  • fs-extra
  • https-proxy-agent
  • ini
  • decompress
  • progress
  • stream-counter

@kneth
Copy link
Contributor

kneth commented Feb 28, 2019

@arnebr @shenjunru I haven't been able to reproduce it from a fresh project (see the attached screenshot):

react-native init Test
cd Test
yarn add realm
react-native link realm
react-native run-ios

screenshot 2019-02-28 at 14 37 02

Moreover, first building a project with v2.23.0 and then upgrade to v2.24.0 also works fine.

When looking at node_modules/realm/node_modules, I see both decompress and http-proxy-agent.

Btw, I am using node v10.13.0 and yarn v1.13.0.

@arnebr
Copy link
Author

arnebr commented Feb 28, 2019

Indeed in a clean space it works fine, don´t know what happend here then. Sry for bothering.

@shenjunru
Copy link

shenjunru commented Mar 4, 2019

@kneth, @arnebr Could you try yarn add realm@2.24.0
NPM and Yarn do not install "devDependencies" of "dependencies"

@kneth
Copy link
Contributor

kneth commented Mar 4, 2019

@shenjunru As I outlined, I did try with yarn.

@shenjunru
Copy link

shenjunru commented Mar 4, 2019

@kneth

Could you check listed packages exist in the project node_modules, not out of project.
Here, It is not work for NPM@6.4.1 and Yarn@1.13.0 with Node@10.14.2 and fresh react-native project.
Thanks.

  • decompress
  • fs-extra
  • https-proxy-agent
  • ini
  • progress

@jeremy303
Copy link

jeremy303 commented Mar 4, 2019

@kneth + @shenjunru

I'm having the same issue w/ npm 6.7.0, upgrading from realm@2.21.1 in an existing project.

@anam-hossain
Copy link

I too got the error:

~/react-native/duacollection (master ✘)✖✹✭ ᐅ npm install -save realm@2.24.0

> realm@2.24.0 install /Users/anam.hossain/react-native/duacollection/node_modules/realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://static.realm.io/node-pre-gyp/2.24.0/realm-v2.24.0-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for realm@2.24.0 and node@11.10.1 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /Users/anam.hossain/react-native/duacollection/node_modules/realm/vendor/realm-mac-x64
internal/modules/cjs/loader.js:615
    throw err;
    ^

Error: Cannot find module 'https-proxy-agent'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
    at Function.Module._load (internal/modules/cjs/loader.js:539:25)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/anam.hossain/react-native/duacollection/node_modules/realm/scripts/download-realm.js:25:25)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
    at Module.load (internal/modules/cjs/loader.js:630:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
    at Function.Module._load (internal/modules/cjs/loader.js:562:3)
make: *** [/Users/anam.hossain/react-native/duacollection/node_modules/realm/vendor/realm-mac-x64] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.10.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/a
am.hossain/react-native/duacollection/node_modules/realm/compiled/node-v67_darwin_x64/realm.node" "--module_name=realm" "--module_path=/Users/anam.hossain/react-native/duacollecti
n/node_modules/realm/compiled/node-v67_darwin_x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /Users/anam.hossain/react-native/duacollection/node_modules/realm
gyp ERR! node -v v11.10.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.10.1/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to
build --module=/Users/anam.hossain/react-native/duacollection/node_modules/realm/compiled/node-v67_darwin_x64/realm.node --module_name=realm --module_path=/Users/anam.hossain/reac
-native/duacollection/node_modules/realm/compiled/node-v67_darwin_x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/anam.hossain/react-native/duacollection/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:984:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.10.1/bin/node" "/Users/anam.hossain/react-native/duacollection/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/anam.hossain/react-native/duacollection/node_modules/realm
node-pre-gyp ERR! node -v v11.10.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.10.1/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/anam.hos
ain/react-native/duacollection/node_modules/realm/compiled/node-v67_darwin_x64/realm.node --module_name=realm --module_path=/Users/anam.hossain/react-native/duacollection/node_mod
les/realm/compiled/node-v67_darwin_x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! realm@2.24.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the realm@2.24.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/anam.hossain/.npm/_logs/2019-03-05T06_45_55_411Z-debug.log

@kneth
Copy link
Contributor

kneth commented Mar 5, 2019

@anam-hossain:

Pre-built binaries not found for realm@2.24.0 and node@11.10.1

We currently don't support node.js v11. Please try again using node.js v10 or v8.

@kneth
Copy link
Contributor

kneth commented Mar 5, 2019

@HolySamosa Upgrading to v2.24.0 brings many new things so you might have to clean your workspace. Did you clean your workspace before building?

@shenjunru
Copy link

shenjunru commented Mar 5, 2019

Found issue.

In v2.24.0, The Xcode project will run [ ! -d node_modules/fs-extra ] && npm install --no-save
Which install those modules locally inside node_modules/realm.
Also install node via nvm (same as previous versions).

I think those are not good behaviors.

  1. Those modules are "real" dependencies for the project use realm-js.
  2. The script does not check exist node.
  3. Usually, the project with realm-js should has node support already.

I also wrote a shell script download-realm.sh to replace download-realm.js
It provides same behavior as download-realm.js.
https://gist.github.com/shenjunru/2328b60558c769fe4975378c8eaacc7d

@kneth
Copy link
Contributor

kneth commented Mar 5, 2019

@shenjunru I have tried with the exact same versions as you, and the modules are installed.
screenshot 2019-03-05 at 15 42 28

@joshuapinter
Copy link

I can confirm that I get this on version 2.24.0 but I don't get this when I change my package.json to version 2.23.0.

@kneth
Copy link
Contributor

kneth commented Mar 11, 2019

@shenjunru It's a good shell script. The reason we wrote it in JS originally was that we also need it on Windows.

The shell script within Xcode is using a particular version of node. The issue here is that if you have multiple versions of node installed, Xcode will pick the default version. Xcode is spawning a new login shell, and therefore it doesn't inherit the settings from any shell.

@kneth kneth mentioned this issue Mar 11, 2019
8 tasks
@jeremy303
Copy link

I'm happy to report that I'm no longer seeing this issue w/ v2.25.0. :-)
@kneth @shenjunru

@StevenMasini
Copy link

I don't have this bug on my machine, but one of my workmate had this issue when compiling our project with realm-js 2.25.0.

He had to add these modules to our package.json.

"command-line-args": "^5.1.1",
"decompress": "^4.2.0",

@kneth
Copy link
Contributor

kneth commented Apr 23, 2019

@StevenMasini We moved those dependencies in v2.26.0 so if you upgrade, it should have been solved.

@navneetgarggate6
Copy link

navneetgarggate6 commented Aug 9, 2019

I added a issue related to this

#2474

@alpamys-qanybet
Copy link

hey guys, you just need to react-native run-ios after react-native link realm and then to Build on Xcode

@tridevsaini

This comment has been minimized.

@tridevsaini

This comment has been minimized.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.