【发布时间】:2016-10-23 07:26:17
【问题描述】:
在全局安装时,react-native 似乎存在错误。我需要它正确执行而不会看到此错误:
$ react-native run-ios
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
其他论坛上发布的解决方案对我不起作用,我不明白为什么这不起作用。
package.json:
{
"name": "react-native-svgkit",
"version": "0.2.2",
"main": "Svg.js",
"description": "A <Svg /> element for react-native that renders Svg images using SVGKit",
"author": "Brent Vatne <brentvatne@gmail.com> (https://github.com/brentvatne)",
"peerDependencies": {
"react": "15.1.0",
"react-native": ">=0.4.4"
},
"devDependencies": {
"react-native": ">=0.4.4",
"react-native-cli": "^0.1.10"
},
"dependencies": {
"d3": "^3.5.5",
"jsdom-jscore": "^0.1.0",
"react-native-svg": "^2.2.0"
},
"repository": {
"type": "git",
"url": "git@github.com:brentvatne/react-native-svgkit.git"
},
"scripts": {
"start": "node /usr/local/lib/node_modules/react-native/local-cli/cli.js start"
}
}
【问题讨论】:
-
你是通过 npm 运行这个命令吗?
-
是的,它位于标准全球位置
/usr/local/bin/react-native -
你能分享你的 package.json 文件吗?
-
react-native-svgkit 是一个旧项目,尚未开发,最新版本的 react-native 不支持。您是对 svg 库感兴趣还是想要升级和维护该库?
-
我感兴趣的不是使用库本身,而是一个将 SVG 带入最新 react-native 的库。
标签: node.js reactjs npm react-native npm-install