如何创建脚本以将构建发布到github上的文档?

时间:2019-04-13 21:34:21

标签: github npm

我有一个构建文件夹,该文件夹将用于发布。我创建的脚本运行成功。

#!/bin/bash

rm -rf docs_bk;mv docs docs_bk 2> /dev/null;mv build docs 2> /dev/null

我通过以下方式更新了权限设置

chmod +x publish.sh

问题是,当我将脚本添加到npm运行脚本时,它将返回错误。

0 info it worked if it ends with ok
1 verbose cli [ '/Users/weijinglin/.nvm/versions/node/v11.8.0/bin/node',
1 verbose cli   '/Users/weijinglin/.nvm/versions/node/v11.8.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'publish' ]
2 info using npm@6.9.0
3 info using node@v11.8.0
4 verbose run-script [ 'prepublish', 'publish', 'postpublish' ]
5 info lifecycle bay-area-tech-companies-map@0.1.0~prepublish: bay-area-tech-companies-map@0.1.0
6 info lifecycle bay-area-tech-companies-map@0.1.0~publish: bay-area-tech-companies-map@0.1.0
7 verbose lifecycle bay-area-tech-companies-map@0.1.0~publish: unsafe-perm in lifecycle true
8 verbose lifecycle bay-area-tech-companies-map@0.1.0~publish: PATH: /Users/weijinglin/.nvm/versions/node/v11.8.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/weijinglin/repos/bay-area-tech-companies-map/node_modules/.bin:/Users/weijinglin/.local/bin:/Users/weijinglin/.yarn/bin:/Users/weijinglin/.config/yarn/global/node_modules/.bin:/Users/weijinglin/.nvm/versions/node/v11.8.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/weijinglin/.local/bin:/Users/weijinglin/.yarn/bin:/Users/weijinglin/.config/yarn/global/node_modules/.bin:/Users/weijinglin/.nvm/versions/node/v11.8.0/bin:/Users/weijinglin/Library/Android/sdk/tools:/Users/weijinglin/Library/Android/sdk/platform-tools:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/weijinglin/Library/Android/sdk/tools:/Users/weijinglin/Library/Android/sdk/platform-tools:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
9 verbose lifecycle bay-area-tech-companies-map@0.1.0~publish: CWD: /Users/weijinglin/repos/bay-area-tech-companies-map
10 silly lifecycle bay-area-tech-companies-map@0.1.0~publish: Args: [ '-c', '../scripts/publish.sh' ]
11 info lifecycle bay-area-tech-companies-map@0.1.0~publish: Failed to exec publish script
12 verbose stack Error: bay-area-tech-companies-map@0.1.0 publish: `../scripts/publish.sh`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/Users/weijinglin/.nvm/versions/node/v11.8.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:197:13)
12 verbose stack     at maybeClose (internal/child_process.js:978:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
13 verbose pkgid bay-area-tech-companies-map@0.1.0
14 verbose cwd /Users/weijinglin/repos/bay-area-tech-companies-map
15 verbose Darwin 17.3.0
16 verbose argv "/Users/weijinglin/.nvm/versions/node/v11.8.0/bin/node" "/Users/weijinglin/.nvm/versions/node/v11.8.0/bin/npm" "run" "publish"
17 verbose node v11.8.0
18 verbose npm  v6.9.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error bay-area-tech-companies-map@0.1.0 publish: `../scripts/publish.sh`
23 error spawn ENOENT
24 error Failed at the bay-area-tech-companies-map@0.1.0 publish script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

看来npm仍然赶不上失败。无论如何,有没有办法使npm忽略npm run脚本上的失败?

0 个答案:

没有答案