lenna run build命令失败。
并且在root package.json.json
中有以下脚本
"scripts": {
"build": "lerna run build",
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
}
},
react monorepo ,
module.exports = {
'**/*.*': 'yarn build',
};
我正在研究 有以下错误:
✖ yarn build:
ERR! lerna Unknown arguments: /Users/xyz/lint-staged.config.js, /Users/xyz/package.json
error Command failed with exit code 1.
$ lerna run build /Users/xyz/lint-staged.config.js /Users/xyz/package.json
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky > pre-commit hook failed (add --no-verify to bypass)
在MonorePo包装夹中,package.json
包含脚本如下: 软件包/webapp/package.json
"scripts": {
"build": "run-s clean compile",
"clean": "rm -rf *.tsbuildinfo & rm -rf build && rm -rf tmp",
"compile": "run-p compile:*",
}
我们不能在绒毛阶段运行构建命令,还是我的实现中缺少某些内容?
谢谢
I am working on a React monorepo and I have the below scripts in the root package.json
:
"scripts": {
"build": "lerna run build",
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
}
},
lint-staged.config.js
module.exports = {
'**/*.*': 'yarn build',
};
When I commit the code, the commit fails with the below error:
✖ yarn build:
ERR! lerna Unknown arguments: /Users/xyz/lint-staged.config.js, /Users/xyz/package.json
error Command failed with exit code 1.
$ lerna run build /Users/xyz/lint-staged.config.js /Users/xyz/package.json
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky > pre-commit hook failed (add --no-verify to bypass)
In the monorepo packages folder, the package.json
contains the scripts as below:package/webApp/package.json
"scripts": {
"build": "run-s clean compile",
"clean": "rm -rf *.tsbuildinfo & rm -rf build && rm -rf tmp",
"compile": "run-p compile:*",
}
Can't we run the build command in lint-staged or is something missing in my implementation?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绒毛阶段
将文件名传递到build
脚本,而lerna
认为这些是参数,无法解决它们。为了避免将文件名传递到构建
脚本,请尝试将您的更改
配置更改为以下内容。上演 - 链接
lint-staged
is passing filenames to thebuild
script, whereaslerna
thinks these are being arguments and can't resolve them. To avoid passing the filenames to thebuild
script, try to change yourlint-staged
configuration to the followingHere is the link to a similar example in the
lint-staged
- Link