How to create a new WPF project?
I try to create a new WPF project as following link: https://github.com/microsoft/react-native-windows/issues/1539#issuecomment-346751673 I ran following command:
react-native init RNwpf --version 0.59.10
cd RNwpf
npm install --save-dev rnpm-plugin-windows
npm install --save-dev rnpm-plugin-wpf
react-native wpf
Then I got this message:
Reading application name from package.json...
Reading react-native version from node_modules...
Checking for react-native-windows version matching 0.59.*...
Reading application name from package.json...
Reading react-native version from node_modules...
Checking for react-native-windows version matching 0.59.*...
Installing [email protected]...
npm WARN [email protected] requires a peer of react-native@^0.59.0 || 0.59.0-microsoft.82 || https://github.com/microsoft/react-native/archive/v0.59.0-microsoft.82.tar.gz but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.57.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
[email protected] successfully installed.
Installing [email protected]...
npm WARN [email protected] requires a peer of react-native@^0.59.0 || 0.59.0-microsoft.82 || https://github.com/microsoft/react-native/archive/v0.59.0-microsoft.82.tar.gz but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.57.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
[email protected] successfully installed.
Cannot find module 'D:\gitlab\react\VS2017\RNwpf\node_modules\react-native-windows\local-cli\generate-wpf.js'
Cannot find module 'D:\gitlab\react\VS2017\RNwpf\node_modules\react-native-windows\local-cli\generate-wpf.js'
How to solve it?
Environment
react-native -v:
react-native-cli: 2.0.1
react-native: 0.59.10
npm ls rnpm-plugin-windows:
[email protected] D:\gitlab\react\VS2017\RNwpf
+-- [email protected]
`-- [email protected]
`-- [email protected] deduped
npm ls rnpm-plugin-wpf:
[email protected] D:\gitlab\react\VS2017\RNwpf
`-- [email protected]
npm ls react-native-windows:
`-- [email protected]
node -v:
v10.5.0
npm -v:
6.1.0
I found rnpm-plugin-wpf was deprecated according to this link: https://github.com/microsoft/react-native-windows/tree/master/current/local-cli/rnpm/wpf
I just skipped the 'npm install --save-dev rnpm-plugin-wpf' step and 'react-native wpf' seemed to work fine with rnpm-plugin-windows.
You can use vnext with XamlIslands to create React Native projects/components in WPF instead of the older WPF implementation. See TodosFeed for how to do this.