为什么“ npm开始”没有“运行”的工作,但没有其他脚本可以吗?
在我的package.json
文件中,有我的“ start”脚本的“脚本”部分。当我键入npm start
时,它将运行“ start”脚本。但是,对于任何其他脚本,您必须通过执行npm运行[脚本名称]
来运行它。
这使我有2个问题:
- 为什么“启动”脚本在不进行
npm运行start start
的情况下工作,但是没有其他脚本没有“运行”? - 有什么方法可以使其他脚本在不进行
NPM运行[脚本名称]
的情况下运行?- 使用npm,答案是否。
但是,如果您查看评论,可以说您可以使用YARN
来执行此操作。
- 使用npm,答案是否。
In my package.json
file, there is the "scripts" section with my "start" script. When I type npm start
it runs the "start" script. But for any other script, you have to run it by doing npm run [script-name]
.
This makes me have 2 questions:
- Why does the "start" script work without doing
npm run start
, but no other scripts work without "run"? - Is there any way to make other scripts run without doing
npm run [script-name]
?- With NPM, the answer is no.
But if you look at the comment, it is said that you can useyarn
to do this.
- With NPM, the answer is no.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是惯例。不,如果没有
运行
,您将无法运行其他脚本。That's by convention. No, you cannot run other scripts without
run
.