bwsw / cloudstack-ui

Modern UI for Apache Cloudstack User Self Service Portal
https://bitworks.software/
Apache License 2.0
163 stars 63 forks source link

Error with my proxy-conf.js #962

Closed kioie closed 6 years ago

kioie commented 6 years ago

I am running Node v9.5.0 and I'm trying to run my proxy-conf.js, and I keep getting a syntax error.

Proxy-conf.js

{
        context: [
            "/client/api"
        ],
        target: "http://192.xxx.xxx.xxx:8080",
        secure: false
    }

I launch using this command

npm start -- --proxy-config proxy-conf.js

And I get the following result

> cloudstack-ui@1.410.18 start /home/cloudstack/cloudstack-ui
> npm run build-themes && ng serve --host 0.0.0.0 --port 8080 "--proxy-config" "proxy-conf.js"

> cloudstack-ui@1.410.18 build-themes /home/cloudstack/cloudstack-ui
> sh ./src/generate-themes.sh

Generating themes
Themes generated successfully
Unexpected token :
/home/cloudstack/cloudstack-ui/proxy-conf.js:5
        target: "http://192.168.31.12:8080",
              ^

SyntaxError: Unexpected token :
    at new Script (vm.js:51:7)
    at createScript (vm.js:138:10)
    at Object.runInThisContext (vm.js:199:10)
    at Module._compile (module.js:624:28)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Class.run (/home/neurotech/cloudstack/cloudstack-ui/node_modules/@angular/cli/tasks/serve.js:153:31)
    at check_port_1.checkPort.then.port (/home/cloudstack/cloudstack-ui/node_modules/@angular/cli/commands/serve.js:123:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cloudstack-ui@1.410.18 start: `npm run build-themes && ng serve --host 0.0.0.0 --port 8080 "--proxy-config" "proxy-conf.js"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cloudstack-ui@1.410.18 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
kioie commented 6 years ago

Update: I have updated my project files, and the error is still persisting.

dariashka commented 6 years ago

Hi @kioie, we've updated our README.md file with more correct instructions for proxy-conf.js. Could you please try this example?

Can we close it?

kioie commented 6 years ago

@qqcky It now works perfectly. Thnks.