[英]Can I run an npm package without the npm run command?
I would like to run the next.js build process directly from the command line without going over the package.json.我想直接从命令行运行 next.js 构建过程,而不需要查看 package.json。 Is it possible to run it without npm run?
是否可以在没有 npm run 的情况下运行它?
Instead of running npm run build
而不是运行
npm run build
I would like to run next build
directly on the command line.我想直接在命令行上运行
next build
。
Cheers for the help.为帮助喝彩。
you can go to package.json and then change the scripts.您可以转到 package.json 然后更改脚本。
"build": "next build", “构建”:“下一个构建”,
I figured it out so basically whatever you add at the end of the npm run command gets attached to the npm run command:我想通了,所以基本上你在 npm run 命令末尾添加的任何内容都会附加到 npm run 命令:
"scripts": {
"dev": "next dev",
"build": "next build",
"export": "next build && next export -o",
}
Now I can run现在我可以跑了
npm export jane-doe-directory
And the application will be exported to that directory.并且应用程序将被导出到该目录。
If you look inside your project's node_modules/.bin
directory, you should see an alias for the next
command.如果您查看项目的
node_modules/.bin
目录,您应该会看到next
命令的别名。 So if you want to run next build
directly without using npm
...所以如果你想直接运行
next build
而不使用npm
...
Bash:重击:
./node_modules/.bin/next build
Windows Command Prompt: Windows 命令提示符:
.\node_modules\.bin\next.cmd build
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.