我试图将此反应组件添加到我的流星项目中: https://github.com/dancormier/react-native-swipeout
我在标准的browserify / npmhacks流程中添加了这个。当我在此后运行应用程序时,我收到此错误:
Marks-MacBook-Air:meteor-app markshust$ meteor --settings settings/dev.json
[[[[[ ~/Sites/meteor-app ]]]]]
=> Started proxy.
=> Started MongoDB.
npm-container: updating npm dependencies -- react-native-swipeout, externalify...
=> Errors prevented startup:
While processing files with cosmos:browserify (for target web.browser):
lib/app.browserify.js: Unexpected token (53:6) while parsing file:
/Users/markshust/Sites/meteor-app/packages/npm-container/.npm/package/node_modules/react-native-swipeout/index.js
While processing files with cosmos:browserify (for target os.osx.x86_64):
lib/app.browserify.js: Unexpected token (53:6) while parsing file:
/Users/markshust/Sites/meteor-app/packages/npm-container/.npm/package/node_modules/react-native-swipeout/index.js
=> Your application has errors. Waiting for file change.
当我拉出https://github.com/dancormier/react-native-swipeout/blob/master/index.js的第53行时,它会击中一些jsx。该文件以.js后缀命名,因此当Meteor遇到jsx代码时出现问题。
我认为当使用来自npm的反应组件与流星时这是一个常见问题。如何轻松解决这个问题?
非常感谢! 标记
packages.json
{
"react-native-swipeout": "2.0.8",
"externalify": "0.1.0"
}
LIB / app.browserify.js
Swipeout = require('react-native-swipeout');
LIB / app.browserify.options.json
{
"transforms": {
"externalify": {
"global": true,
"external": {
"react": "React.require"
}
}
}
}
答案 0 :(得分:0)
react-native-swipeout peer dependencies react-native 所以你需要在packages.json或package.js中添加react-native添加Npm.depends
meteor 1.3仍然使用node0.10,但是react-native需要节点0.12,所以react-native-swipeout需要等待流星1.4才能使用
$ MONGO_VERSION =" 2.6.7"
$ NODE_VERSION =" 0.10.45"
$ NPM_VERSION =" 2.15.1"
$ PYTHON_VERSION =" 2.7.10"