简体   繁体   English

我应该在我的 package.json 文件中放入什么来让“纱线开始”工作?

[英]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.

相关问题 在我的 npm 包的 package.json 中我需要什么才能将其安装到另一个项目? - What do I need in the package.json of my npm package, to install it to another project? 在我更新 package.json 中的依赖项版本并运行 yarn install 或仅运行 yarn 后,yarn.lock 文件未更新 - yarn.lock file is not updating after I update the version of a dependency in package.json and run yarn install or just yarn 需要更改此package.json文件才能使用npm 0.3.0? - What needs to change in this package.json file to work with npm 0.3.0? 为什么程序包在我的yarn.lock中而不在我的package.json中? - Why are packages in my yarn.lock but not in my package.json? 如何向运行 javascript 文件的 package.json 文件添加自定义脚本? - How do I add a custom script to my package.json file that runs a javascript file? 我已将我的 package.json 文件在 react 项目中上移了一个文件夹,现在 `npm start` 不起作用 - I have moved my package.json file one folder up in react project and now `npm start` is not working 如何将文件路径放入 package.json 文件中 - How to put file path in package.json file 我可以在 package.json 中再放一些东西吗? - I can put a few more things in the package.json? 如何在 Yarn 工作区的一个 package.json 文件中安装软件包? - How to install packages in just one package.json file in Yarn workspaces? 什么是我的package.json添加输入行,为什么? - What is adding entry lines to my package.json, and why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM