ncc icon indicating copy to clipboard operation
ncc copied to clipboard

Failed build process, for required npm-check-updates

Open uruha opened this issue 5 years ago β€’ 4 comments

Hi !, I have a question about building ncc πŸ₯Ί.

Currently, I'm developing github-actions that uses npm-check-updates, but apparently when I build index.js that requires npm-check-updates, I get the following error Appears and I cannot output.

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2020-08-25 13 37 34 (Is node-gyp involved? ? ? πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”οΌ‰

Is there any correspondence or setting that we have to do? Is the node version affected? ? ? This build also had a similar error with the TypeScript version.

Verification please!

πŸ‘‰ PR currently supported

uruha avatar Aug 25 '20 04:08 uruha

Encountered a similar error:

ncc: Version 0.25.1
ncc: Compiling file index.js
 62kB  dist/pre/index.js
 70kB  dist/pre/index.js.map
122kB  dist/pre/sourcemap-register.js
184kB  [548ms] - ncc 0.25.1

> [email protected] build:main /Users/privatenumber/gits/action
> ncc build -s  -o dist/main src/index.js && :

ncc: Version 0.25.1
ncc: Compiling file index.js
Error: Module parse failed: Unexpected token (47:25)
File was processed with these loaders:
 * ./node_modules/@vercel/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
|       npm_lifecycle_event: event,
|       npm_lifecycle_script: cmd,
>       __webpack_require__.ab + "node-gyp.js",
|     }),
|     stdioString,
    at /Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:3258160
    at /Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:2210952
    at eval (eval at create (/Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:1140142), <anonymous>:11:1)

I identified that this was caused by @npmcli/run-script/lib/make-spawn-args.js:5 doing require.resolve('node-gyp/bin/node-gyp.js').

I fixed this by externalizing @npmcli/run-script:

ncc build -s --external='@npmcli/run-script' -o dist/main src/index.js

and adding @npcli/runscript and its dependencies to git.

PS, I recommend copy-pasting the error message instead of screen-shotting it so that people searching for this same error can find this issue.

privatenumber avatar Dec 04 '20 08:12 privatenumber

@privatenumber

and adding @npcli/runscript and its dependencies to git

How exactly did you do this?

StephenMP avatar Apr 01 '22 20:04 StephenMP

Sorry this was a long time ago and I don't remember this specific problem.

However, I do remember I realized ncc is not a requirement for developing GitHub Actions and just using Rollup is a lot easier and faster: https://github.com/pkg-size/action/blob/develop/rollup.config.js

privatenumber avatar Apr 01 '22 20:04 privatenumber

@privatenumber Yea, I've tried rollup and could never get it to work. I have referenced your rollup config as well with no luck 🀷 Thanks for the reply though, appreciate it :)

StephenMP avatar Apr 01 '22 20:04 StephenMP