[英]What do I put in my package.json file to get "yarn start" to work?
I am currently following a tutorial on how to setup and use toastify, and I have followed the tutorial up to the point where the person in the tutorial inputs yarn start
into the terminal, and his code output opens in his browser.我目前正在学习如何设置和使用 toastify 的教程,并且我一直遵循教程直到教程中的人将
yarn start
输入终端,并且他的代码 output 在他的浏览器中打开。 but when I do it the terminal outputs this: yarn run v1.22.4 warning package.json: No license field error Command "start" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
但是当我这样做时,终端会输出:
yarn run v1.22.4 warning package.json: No license field error Command "start" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.4 warning package.json: No license field error Command "start" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
and nothing happens.什么也没有发生。 I followed the tutorial exactly and the person in the tutorial does not do anything with packag.json and his code still works.
我完全按照教程进行了操作,教程中的人没有对 packag.json 做任何事情,他的代码仍然有效。 Why isn't my code working?
为什么我的代码不起作用? and how do I fix it?
我该如何解决?
You should have a start script defined in your package.json您应该在 package.json 中定义一个启动脚本
Ex:前任:
{
"scripts": {
"start": "You should write your start script here"
}
}
I've been in the same situation before, Maybe you'd better check that you're running the command in the right directory.我之前也遇到过同样的情况,可能你最好检查一下你在正确的目录下运行命令。
you should write 'start' in package.json你应该在 package.json 中写“开始”
if you have a react-native app,如果您有 react-native 应用程序,
"scripts": {
"start": "react-native start"
}
npm run start
with the definition at the package.json like this: npm run start
,如下所示:
"start": "react-scripts start",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.