Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

KNietzsche's avatar

npm echarts with project name echarts & axios: 2 questions

I have created a project with name echarts and have installed echarts with npm install echarts --save like described on echarts doc

When I try to use webpack to compile the test I get the following error

npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "echarts" "--save"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ENOSELF

npm ERR! Refusing to install package with name "echarts" under a package
npm ERR! also called "echarts". Did you name your project the same
npm ERR! as the dependency you're installing?```

So my first question is.... can there be some issue when you give a name to a project which is the same as a package you install, and use webpack ?

Second question... I have created a vue component under the /src/ folder ....created with vue init webpack This component created an echarts chart and all was ok then I wanted to use Axios to get the data from a url The route was Route::get('data')

  created(){
                // axios.get('/api/data').
                this.$http.get('/echart').
                then (function(response){ 
                    this.rawdata = response.data;
                })
        },

but in the browser I got 404 error, url is unknown;..url was localhost:8080/echart


Is there something special to use with axios like DIR_PATH when we use vue-cli or vue init to be able to process axios commands ?

I don't know if I explained all clearly, but if you have some answers, I would appreciate !
Tks
0 likes
1 reply
KNietzsche's avatar

I believe I need to use 'vue-router' to achieve my goal for the second question, because it's running like a spa indeed in this case. And for the first one, I believe I will stop to give the same name as a package to my project names.

Please or to participate in this conversation.