与UWP反应原生 - 如何设置反应原生的UWP环境?

时间:2016-10-19 13:11:33

标签: react-native uwp windows-applications

我有一个特定的要求,即使用UWP为使用Windows设备创建应用程序时使用react native。我搜索了有关UWP支持的Windows原生反应,然后我跟着https://github.com/ReactWindows/react-native-windows

我 NPM版本:2.15.9

节点版本:4.6.1

我跟着

命令:

choco install nodejs.install

npm install -g react-native-cli

react-native init AwesomeProject

cd AwesomeProject

npm install --save-dev rnpm-plugin-windows

react-native windows

然后我得到了以下错误

E:\ reactApps \ myapp \ sample1> react-native windows E:\ reactApps \ MYAPP \ SAMPLE1 \ node_modules \反应母语\ node_modules \巴贝尔核心\ LIB \转化\文件\选项\期权manager.js:176           抛出新的ReferenceError(messages.get(" pluginUnknown",plugin,loc,i,dirname));           ^

ReferenceError:未知插件" transform-flow-strip-types"在" base"中指定在0,试图解决相对于" E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native-windows \ local-cli"     在E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:176:17     在Array.map(本机)     在Function.normalisePlugins(E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:154:20)     在OptionManager.mergeOptions(E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:228:36)     在OptionManager.init(E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:373:12)     在编译时(E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-register \ lib \ node.js:103:45)     在loader(E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-register \ lib \ node.js:144:14)     at Object.require.extensions。(匿名函数)[as .js](E:\ reactApps \ myapp \ sample1 \ node_modules \ react-native \ node_modules \ babel-register \ lib \ node.js:154:7)     在Module.load(module.js:343:32)     在Function.Module._load(module.js:300:12)

React native ref

1 个答案:

答案 0 :(得分:1)

此问题与您正在使用的NPM版本有关。你应该至少使用npm@3.*。尝试使用npm upgrade npm@latest进行升级。

之后,您需要删除node_modules文件夹并在项目目录中重新运行npm install