我是React-Native的新手,我想安装yarn
以下命令是我初始化yarn start
后收到的错误
我还提供了我安装的npm
和nodejs
的版本
PS E:\Native\confusion> node -v
v12.18.1
PS E:\Native\confusion> npm -v
6.14.5
PS E:\Native\confusion> yarn -v
1.22.4
PS E:\Native\confusion> yarn start
yarn run v1.22.4
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
这是我的package.json
文件
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "2.0.1"
}
}
答案 0 :(得分:1)
问题是,在package.json
中没有为start
命令定义任何内容。为了对其进行修复,您必须像这样创建一个新的json-node,并用您希望启动脚本执行的任何命令填充它:
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "COMMAND WHICH SHOULD GET EXECUTED GOES HERE"
}
"devDependencies": {
"react-native-scripts": "2.0.1"
}
}
定义此命令后,可以执行yarn start
,它将运行您的命令。