【发布时间】:2019-09-20 05:34:08
【问题描述】:
我正在尝试将脚本添加到 package.json 文件中的脚本监视。 例如,我得到了:
{
"scripts": {
"delete": "rm -f wwwroot/*.js wwwroot/*.css wwwroot/*.html wwwroot/*.map"
"watch": "npm run delete; parcel watch Client/index.html --out-dir wwwroot"
}
}
然后当我在终端中运行npm run watch 时,它会抛出这个错误:
> projectName@1.0.0 watch C:\Users\username\userProjectName\path\ProjectName
> npm run delete; parcel watch Client/index.html --out-dir wwwroot
npm ERR! missing script: delete;
npm ERR!
npm ERR! Did you mean this?
npm ERR! delete
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache\_logs\2019-05-01T17_17_44_173Z-debug.lognpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projectName@1.0.0 watch: `npm run delete; parcel watch Client/index.html --out-dir wwwroot`
npm ERR! Exit status 1npm ERR!
npm ERR! Failed at the projectName@1.0.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache\_logs\2019-05-01T17_17_44_193Z-debug.log
但是当我手动运行它时,我的意思是实际上去终端并输入:npm run delete; parcel watch Client/index.html --out-dir wwwroot,它运行完美
【问题讨论】:
-
那么什么不起作用?
-
复制该行,根据您的需要进行更改?
-
@DarkFalcon 当我调用“npm run watch”时抛出一个错误。
-
然后在您的帖子中包含错误。我们不介意读者......
标签: javascript json npm package.json npm-scripts