birdofpreyru / react-native-fs

File system access for React Native
https://dr.pogodin.studio/docs/react-native-file-system
Other
121 stars 8 forks source link

Build error on VS2022: ReactNativeFs\ReactPackageProvider.idl(3): error MIDL2025: [msg]syntax error [context]: expecting . near "]" #7

Closed flashkicker closed 9 months ago

flashkicker commented 10 months ago

Hello, first of all great initiative on creating this updated fork for react-native-fs 👏👏👏

I've been trying to install and build this fork on my project and it builds successfully on the JS side, autolinks without any issues as well, however, when when building on VS 2022 I get the following error:

C:\project\node_modules\@dr.pogodin\react-native-fs\windows\ReactNativeFs\ReactPackageProvider.idl(3): error MIDL2025: [msg]syntax error [context]: expecting . near "]"

Any ideas or insight into what this error means and how to move past it would be hugely appreciated! @birdofpreyru

Happy to provide any info that you may need to better understand the error :)

birdofpreyru commented 10 months ago

Hi @flashkicker ,

I don't know, windows\ReactNativeFs\ReactPackageProvider.idl is a very simple file, coming from the standard RN library template for Windows, created by react-native-windows, which does not require any customization for a particular library, I believe. To be honest, I hence don't know much about IDL files, but looking at it, I guess its third line [webhosthidden] is some sort of placeholder, where something is injected during the build. As it complains about it, my first naive guess is either you are trying to build it with older RN / RNW versions, and it is incompatible (I develop with the latest versions, and if it is the case, please tell what versions were that, so I can specify the requirement in package.json); or probably you haven't done a completely clean build, and some artifacts from an old build interfere with the new one.

Have you tried to build the Example app, by the way?

flashkicker commented 10 months ago

@birdofpreyru We are currently on RN 0.70 and 0.70.19 for RNW. We are currently in the process of upgrading to RN 0.72 in our project.

I did try a complete clean build multiple times on both VS2022 and VS2019 and saw the same error. I also compared the .idl file with other community libraries in our project and they look exactly the same!

Haven't tried the example app yet, but will do!

birdofpreyru commented 10 months ago

Ok, @flashkicker , keep me posted if it works for you with 0.72.

flashkicker commented 10 months ago

I'm seeing this error when running the example app:

image

All I did was npm install -> npm run windows

I'm on node version 16.13.1 @birdofpreyru

birdofpreyru commented 10 months ago

Have you done npm install both in the root folder of the code base, and inside its example folder?

flashkicker commented 10 months ago

It worked after running npm install in the root folder :) I hadn't done that. Thanks!

birdofpreyru commented 10 months ago

Great!

A note for myself — README.md of Example App should be updated, to make it clear how to install & run it.

flashkicker commented 9 months ago

Our upgrade to RN 0.72 is taking longer than expected. Is there any way I can modify this fork to be on RN 0.70 just to test it out? @birdofpreyru

birdofpreyru commented 9 months ago

Not that I really know, out of my head, what are the differences between RN 0.70 and 0.72 that prevent it from work. However, the library scaffolding was created using create-react-native-library CLI, and then adding Windows support following these instructions. In theory, you can use these to create library scaffoldings for specific RN versions, 0.70 and 0.72, compare them, see what is the difference, and maybe apply it to the library... In practice, I am not sure it is worth the efforts.