Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No valid exports main found for '\node_modules\uuid' #2090

Closed
diogomartino opened this issue May 9, 2020 · 6 comments
Closed

Error: No valid exports main found for '\node_modules\uuid' #2090

diogomartino opened this issue May 9, 2020 · 6 comments
Assignees
Labels
needs more info This issue needs more information from the customer to proceed. type: question Request for information or clarification. Not an issue.

Comments

@diogomartino
Copy link

Environment details

  • OS: Windows 10
  • Node.js version: v13.2.0
  • npm version: 6.13.1
  • googleapis version: 50.0.0

Steps to reproduce

  1. const { google } = require('googleapis');

When trying to use the youtube upload sample, it throws this error:

Error: No valid exports main found for '\node_modules\uuid'
    at resolveExportsTarget (internal/modules/cjs/loader.js:611:9)
    at applyExports (internal/modules/cjs/loader.js:492:14)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:643:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:941:27)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at Object.<anonymous> (\node_modules\googleapis-common\build\src\apirequest.js:19:14)
    at Module._compile (internal/modules/cjs/loader.js:1121:30) {
  code: 'MODULE_NOT_FOUND'
}
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label May 10, 2020
@sofisl sofisl added the needs more info This issue needs more information from the customer to proceed. label May 11, 2020
@sofisl
Copy link
Contributor

sofisl commented May 11, 2020

Hi @Bruxo00,

Would you mind including the code snippet which is failing? Just confirming, have you already installed googleapis before running the code sample?

Would you also mind trying running rm -rf node_modules package-lock.json && npm install to ensure the dependencies are up-to-date? Thanks in advance!

@JustinBeckwith JustinBeckwith added the type: question Request for information or clarification. Not an issue. label May 11, 2020
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label May 11, 2020
@diogomartino
Copy link
Author

Hi @sofisl, thanks for the tips. I had already tried that, reinstalled everything multiple times. In my case, the steps to reproduce the issue are:

npm init
npm install --save googleapis

Then I import googleapis on my file

const { google } = require('googleapis');

Run the file

node app.js

And it throws the error.

@diogomartino
Copy link
Author

Ok, just tried the same steps on my Linux machine and it works... Don't know if this is a specific problem of my computer or if it doesn't work in every Windows machine... Gonna try in my laptop that also has Windows installed and I'm gonna see if it does the same. Btw my Linux machine has:

Ubuntu 19.10
NodeJS v13.9.0
NPM 6.13.7

@diogomartino
Copy link
Author

Tried on my laptop and it worked. Updated NodeJS on this machine to v14.2.0 and now it's working fine.

@paulirish
Copy link

I can also reproduce this bug, with a slightly different error message, but the stack is otherwise the same.

Error: Package exports for './node_modules/uuid' do not define a valid '.' target

Node v13.1.0
mac os 10.14.6

my index.js and package.json:

const {google} = require('googleapis');
{
  "name": "cruxapinode",
  "main": "index.js",
  "dependencies": {
    "googleapis": "^52.1.0"
  }
}
node index.js

@paulirish
Copy link

paulirish commented Jun 11, 2020

Ah. uuid doesn't support node v13. uuidjs/uuid#466 (comment)

works fine on node 14.4.0. sgtm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info This issue needs more information from the customer to proceed. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

5 participants