1

I have a build folder which would be used for publish. I created a script runs successfully.

#!/bin/bash

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

I updated the permission settings by

chmod +x publish.sh

The question is, when I add the script to the npm run script, it would return the error.

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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prepublish', 'publish', 'postpublish' ]
5 info lifecycle [email protected]~prepublish: [email protected]
6 info lifecycle [email protected]~publish: [email protected]
7 verbose lifecycle [email protected]~publish: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~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 [email protected]~publish: CWD: /Users/weijinglin/repos/bay-area-tech-companies-map
10 silly lifecycle [email protected]~publish: Args: [ '-c', '../scripts/publish.sh' ]
11 info lifecycle [email protected]~publish: Failed to exec publish script
12 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] publish: `../scripts/publish.sh`
23 error spawn ENOENT
24 error Failed at the [email protected] publish script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

It seems npm still catch the fail. Is there anyway to make npm ignore the fail on npm run script?

9
  • 1
    Is that the only logging output provided? Commented Apr 13, 2019 at 21:37
  • Does 34937724 help? Commented Apr 13, 2019 at 21:40
  • can you provide your package.json ? Commented Apr 15, 2019 at 0:23
  • @WaLidLui It is normal creat-react-app json, with empty code. Commented Apr 15, 2019 at 3:53
  • @RichS I share the full log; and rsync solution also break the npm run Commented Apr 15, 2019 at 3:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.