Skip to content

Installing in a new react-native project: missing yarn.lock #23

@loredanacirstea

Description

@loredanacirstea

tldr;
Add the yarn.lock file to the npm published package.
Otherwise, if you use this package in a new RN app, you will need to manually add it. But if you cd ./node_modules/@berty/weshnet-expo && yarn you may encounter some bundling issues, so I just copied yarn.lock from the @berty/weshnet-expo repo and it worked.

  • new expo project, I installed npx expo install @berty/weshnet-expo and then rebuilt ios/android:
$ npx expo prebuild --clean
✔ Cleared android, ios code
✔ Created native directories
✔ Updated package.json | no changes
✔ Finished prebuild
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: /bin/bash -c
set -e
make -C .. build.ios

make: *** No rule to make target `yarn.lock', needed by `node_modules'.  Stop.

pod install --repo-update --ansi exited with non-zero code: 1

I see that node_modules/@berty/weshnet-expo does not contain yarn.lock, which seems to be required by the build process in node_modules/@berty/weshnet-expo/Makefile.

So I did a yarn in node_modules/@berty/weshnet-expo, I got the following errors:

$ expo-module prepare && sh prepare.sh
Configuring module
expo-module-scripts: README.md exists, not updating
src/api/index.ts:1:10 - error TS2305: Module '"./protocoltypes.pb"' has no exported member 'default'.

1 import { default as protocolpb } from './protocoltypes.pb'
           ~~~~~~~

src/api/index.ts:2:10 - error TS2305: Module '"./rpcmanager.pb"' has no exported member 'default'.

2 import { default as rpcmanagerpb } from './rpcmanager.pb'
           ~~~~~~~

src/error.ts:2:8 - error TS1192: Module '"/Users/user/mobile/amigo/amigo/node_modules/@berty/weshnet-expo/src/api/index"' has no default export.

2 import types from './api/index.d'
         ~~~~~

src/rpc/rpc.bridge.ts:6:8 - error TS1192: Module '"/Users/user/mobile/amigo/amigo/node_modules/@berty/weshnet-expo/src/api/index"' has no default export.

6 import types from '../api/index.d'
         ~~~~~

src/weshnet.types.gen.ts:2:8 - error TS1192: Module '"/Users/user/mobile/amigo/amigo/node_modules/@berty/weshnet-expo/src/api/index"' has no default export.

2 import api from './api/index.d'
         ~~~
Found 5 errors in 4 files.

Errors  Files
     2  src/api/index.ts:1
     1  src/error.ts:2
     1  src/rpc/rpc.bridge.ts:6
     1  src/weshnet.types.gen.ts:2
error Command failed with exit code 2.

If I ignore the above errors, npx expo prebuild --clean executes without errors. But running on the ios simulator gives a runtime error, because the build process did not finalize and the pb.js files were not included in the build.

iOS Bundling failed 4672ms node_modules/expo/AppEntry.js (752 modules)
Unable to resolve "./protocoltypes.pb" from "node_modules/@berty/weshnet-expo/build/api/index.js"

So I reinstalled weshnet-expo, copied the yarn.lock from this repo, rebuilt and the ios app seems to work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions