akamai / cli-sandbox

Akamai CLI for Sandbox
https://github.com/akamai/cli
Apache License 2.0
13 stars 12 forks source link

npm build is not executed upon install #24

Closed lukaszczerpak closed 3 years ago

lukaszczerpak commented 5 years ago

When cli-sandbox is installed, apparently the CLI doesn't run build command which results in broken cli and the following error:

~ # akamai sandbox
module.js:550
    throw err;
    ^

Error: Cannot find module './bin/cli-main.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/cli/.akamai-cli/src/cli-sandbox/akamai-sandbox:3:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

Steps to reproduce:

$ docker run -it -P --name test1 alpine

~ # export AKAMAI_CLI_HOME=/cli
~ # export GOROOT=/usr/lib/go
~ # export GOPATH=/go

~ # mkdir -p /cli/.akamai-cli
~ # apk add --no-cache docker git bash python2 python2-dev py2-pip python3 python3-dev npm wget jq openssl openssl-dev curl nodejs build-base libffi libffi-dev vim nano util-linux go dep tree bind-tools 
~ # apk add openjdk8 libc6-compat
~ # go get github.com/akamai/cli && cd $GOPATH/src/github.com/akamai/cli && dep ensure && go build -o /usr/local/bin/akamai
~ # akamai install sandbox

~ # akamai sandbox
module.js:550
    throw err;
    ^

Error: Cannot find module './bin/cli-main.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/cli/.akamai-cli/src/cli-sandbox/akamai-sandbox:3:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

Can be easily fixed:

~ # cd $AKAMAI_CLI_HOME/.akamai-cli/src/cli-sandbox/
/cli/.akamai-cli/src/cli-sandbox # npm run build

~ # akamai sandbox
Usage:  [options] [command]

A tool to help manage Akamai Sandboxes. Uses the sandbox {OPEN} API.
...
krzyk commented 4 years ago

pending https://github.com/akamai/cli/pull/97

krzyk commented 3 years ago

@lukaszczerpak I think this works right now with the new dockers. So let me close it and if it doen't we can reopen it.