npm start 和 npm run start 的区别 [英] Difference between npm start and npm run start
问题描述
我已经检查了 npm start
和 npm run start
这两个命令,两者都运行良好.我使用了 create-react-app.但是为了在 CSS 模块中进行配置更改,我运行 npm eject
但它抛出了一个错误.
I have checked both commands npm start
and npm run start
, both works perfectly. I used create-react-app. But to make configuration changes in the CSS module, I run npm eject
but it throws an error.
但是 npm run eject
有效吗?我很困惑为什么 npm eject
不起作用.我可以配置吗?
But npm run eject
worked? I'm confused on why npm eject
didn't work. Can I configure this?
下面是我的package.json
:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
推荐答案
npm test
、npm start
、npm restart
和 npm stop
都是 npm run xxx 的别名.
对于您定义的所有其他 scripts
,您需要使用 npm run xxx
语法.
For all other scripts
you define, you need to use the npm run xxx
syntax.
请参阅 https://docs.npmjs.com/cli/run-script 了解更多信息.
See the docs at https://docs.npmjs.com/cli/run-script for more information.
这篇关于npm start 和 npm run start 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!