PokeAPI / pokedex-promise-v2

An easy way to use pokeapi v2 with promises in node.js
MIT License
516 stars 91 forks source link

Cannot find module "axios" #30

Closed PhunStyle closed 6 years ago

PhunStyle commented 6 years ago

When i run an npm install with pokedex-promise-v2 on the latest version and then run my code, it complains about axios not being found. This was after a rm -rf of my node_modules and a fresh npm install.

Before this happened i was still running version 3.0.3.

Naramsim commented 6 years ago

Hi, it's strange. In the package.json we have defined Axios as a dependency

https://github.com/PokeAPI/pokedex-promise-v2/blob/bd3995a74533213cf27a2bc0b207e8f4d189acda/package.json#L36

Please update you pokedex-promise-v2 at versions 3.1.0 in your package.json and then install again the dependencies.

GeoffreyDick commented 6 years ago

I'm having the same problem when installing through npm. The package.json does list async, es6-promise, memory-cache, and axios as dependencies, however only async is installed as a dependency when npm install is run.

I managed to get npm to install the dependencies by manually adding pokedex-promise-v2's dependencies to my package-lock.json file, however this does not fix the error. It looks like it might be a problem when building the package because the npm index.js file and the GitHub index.js file aren't the same. First of all, there's no require("axios") in the npm file, and secondly, the npm file also has the following code:

function(){var e=new Error('Cannot find module "axios"');throw e.code="MODULE_NOT_FOUND",e}

I'll take a closer look at the source files tomorrow and see if I can find out what's going on.

Naramsim commented 6 years ago

Hi, I can confirm that installing the latest module through npm gives the upper error, while installing as

npm install PokeAPI/pokedex-promise-v2

gives no error

Naramsim commented 6 years ago

OK, everything is clear now. The module on NPM is corrupted. I published from my PC another module, and everything works fine: https://www.npmjs.com/package/pokedex-promise-v21.

Probably when @TheTommyTwitch published the package something went wrong, Thomas can you please try re-run npm publish (before all, give an npm i) having at least node 8 and npm 5?

So, the correct sequence for publishing right now should be:

rm -r node_modules
node -v # 8
npm -v # 5
npm i
npm publish
tasadurian commented 6 years ago

@Naramsim check #31

Naramsim commented 6 years ago

Seems to work on my machine, but I don´t understand why you get a different Webpack build with respect to the master branch one. Anyway, the changes are really smalls, even unnoticeable.

tasadurian commented 6 years ago

Not sure. I may have an older version of Webpack. The module seems to be working again now?

Naramsim commented 6 years ago

Yep, just tested and it works, let's wait for @PhunStyle, then we can close

PhunStyle commented 6 years ago

Guys, thanks for the swift responses. I can confirm that 3.1.1 installs and works smoothly now. selection_077