Search code examples
node.jsamazon-web-servicesgoogle-chromenpmmacos-mojave

Unable to get this NPM command to run on Mojave


Want to use this chrome-aws-lambda project. Cannot get this command to run on OSX Mojave:

Is there a specific directory I should be in to run this command?

Is there a specific way I need to modify the command to be compatible with Mojave?

MacBook-Pro:chrome-aws-lambda juan$ npm pack && \
> mkdir --parents nodejs/node_modules/chrome-aws-lambda/ && \
> tar --directory nodejs/node_modules/chrome-aws-lambda/ --extract -- 
file chrome-aws-lambda-*.tgz --strip-components=1 && \
> rm chrome-aws-lambda-*.tgz && \
> zip -9 --filesync --move --recurse-paths _/chrome-aws-lambda.layer.zip nodejs/
npm notice 
npm notice 📦  chrome-aws-lambda@1.0.0
npm notice === Tarball Contents === 
npm notice 213B package.json
npm notice === Tarball Details === 
npm notice name:          chrome-aws-lambda                       
npm notice version:       1.0.0                                   
npm notice filename:      chrome-aws-lambda-1.0.0.tgz             
npm notice package size:  250 B                                   
npm notice unpacked size: 213 B                                   
npm notice shasum:        f719b0ff945036a499583e6053d2e80345cc4a0a
npm notice integrity:     sha512-JDqf17BONl8f/[...]YbnkKo25JUCNA==
npm notice total files:   1                                       
npm notice 
chrome-aws-lambda-1.0.0.tgz
mkdir: illegal option -- -
usage: mkdir [-pv] [-m mode] directory ...
MacBook-Pro:chrome-aws-lambda juan$ 

Solution

  • Macs don't understand long form parameters (like --parents in your case). Replace long form params by short forms:

    mkdir --parents -> mkdir -p
    tar --directory -> tar -C
        --extract -> -x