我 NPM版本:2.15.9
命令:
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)
答案 0 :(得分:1)
此问题与您正在使用的NPM版本有关。你应该至少使用npm@3.*。尝试使用npm upgrade npm@latest
进行升级。
之后,您需要删除node_modules
文件夹并在项目目录中重新运行npm install
。