我已经检查了 npm start
和 npm run start
这两个命令,它们都可以完美地运行。我使用的是 create-react-app 来创建应用程序。但是,为了对 CSS 模块进行配置更改,我运行了 npm eject
,但它抛出了一个错误。
但是 npm run eject
就可以工作吗?我很困惑为什么 npm eject
不能正常工作。我能够做出配置更改吗?
下面是我的 package.json
:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
npm test
与npm run test
的作用完全相同,npm start
与npm run start
的作用也是完全相同,其他命令同理。 - AKXnpm start
被频繁使用,因此需要一个别名。 - AKXstart
脚本之前和之后,它还会运行prestart
和poststart
脚本。https://docs.npmjs.com/misc/scripts - hashlashnpm run *
同样适用。npm run foo
会运行prefoo
,foo
,postfoo
。 - AKX