我有一个Google Apps脚本项目,我正在尝试从npm或yarn脚本运行clasp push
。我可以从命令行运行clasp push
,但是当用作脚本时,同一命令将失败:
"scripts": {
"push": "clasp push"
}
当以npm run push
或yarn push
运行时,脚本将失败,并输出> Did you provide the correct scriptId?
。如果我直接在命令行上运行clasp push
,它将成功将我的项目文件推送到Google Apps脚本。
我已验证脚本正在包含.clasprc.json和appsscript.json的目录中执行。这是完整的输出:
> @ push /gs
> cd build && ls -a && clasp push
. .. .clasp.json .clasprc.json appsscript.json build.gs
> Did you provide the correct scriptId?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ push: `cd build && ls -a && clasp push`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ push script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
关于上下文,我正在尝试做与此博客文章类似的事情:https://labs.clio.com/a-modern-gmail-add-on-build-process-3dd7aad111f5
您提供了正确的scriptId吗?
.clasp.json
以在运行扣之前进行构建。.clasp.json
示例
shell
$> cd build && cp ./../.clasp.json ./ && ls -a && clasp push
.clasp.json
{
"scriptId": "17qJJk9kvCm2abutL1MUNzfSUd9aeieJAGRdKF_4QG4-EkxQC5C6jHyIP",
"rootDir": "build"
}