pbojinov / request-ip

A Node.js module for retrieving a request's IP address on the server.
https://npmjs.com/package/request-ip
MIT License
823 stars 102 forks source link

Error: Cannot find module './is' #65

Closed hungtcs closed 2 years ago

hungtcs commented 2 years ago

version 3.1.0 missing is.js in dist folder

image

AliSaberi commented 2 years ago

I have the same issue !!!

hungtcs commented 2 years ago

I am now back to 3.0.2, and 3.0.2 uses an external npm package

https://github.com/pbojinov/request-ip/blob/a2f411bd546e3f07b0bb702a958d955bef84a461/dist/index.js#L5

Looks like forgot to modify the build command

https://github.com/pbojinov/request-ip/blob/d1219037770b6707bf88d38beb866a6a0012c90a/package.json#L54

@pbojinov

enricoros commented 2 years ago

+1 Same issue. Production borken 🤦

wouterlemcke commented 2 years ago

+1

perrin4869 commented 2 years ago

maybe best to remove babel from this repo? don't see any features that need transpiling these days

jblyberg commented 2 years ago

+1

pbojinov commented 2 years ago

I'll fix this tonight, sorry everyone

pbojinov commented 2 years ago

maybe best to remove babel from this repo? don't see any features that need transpiling these days

That's a good point. I had added Babel over 4 years ago when none of the ES6 features were in Node. It's probably not needed.

pbojinov commented 2 years ago

Released 3.2.0 with an updated build file. Let me know if this works for everyone.

xiazhichen1 commented 2 years ago

Upgrading to 3.2.0 gives me: Error: Cannot find module '\node_modules\request-ip\lib\index.js'. Please verify that the package.json has a valid "main" entry

I have tried deleted node_modules and reinstall but still the same error.

hungtcs commented 2 years ago

Need to include lib folder in package.json files entry.

You can use npm pack or npm publish --dry-run run to verify the package.

https://github.com/pbojinov/request-ip/blob/3feaa1356a7877a28c4b49b53a98209d481caa8f/package.json#L49-L51

$ ll node_modules/request-ip 
Permissions Size User    Group Date Modified Git Name
.rw-r--r--  1.1k hungtcs staff  7 7 10:33     -I LICENSE.md
.rw-r--r--  1.8k hungtcs staff  7 7 10:33     -I package.json
.rw-r--r--  3.1k hungtcs staff  7 7 10:33     -I README.md
pbojinov commented 2 years ago

Thank you for that! Just added that to 3.3.0 and tested it locally. It's working without throwing any errors.

image