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

*cannot find module* when using require.resolve #116

Closed
TomasHubelbauer opened this issue Jul 13, 2019 · 1 comment
Closed

*cannot find module* when using require.resolve #116

TomasHubelbauer opened this issue Jul 13, 2019 · 1 comment

Comments

@TomasHubelbauer
Copy link

TomasHubelbauer commented Jul 13, 2019

I am following Integrating with Yeoman and I have the same code, just with VS Code instead of NPM generator:

const yeoman = require('yeoman-environment');

const environment = yeoman.createEnv();

// https://code.visualstudio.com/api/get-started/your-first-extension
environment.register(require.resolve('generator-code'));
environment.run();

I have installed both yeoman-environment and generator-code and both is in my package.json's dependencies.

Have I missed a step? I am getting this error:

internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'generator-code'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\keytar-vscode-extension\code\index.js:6:22)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
@TomasHubelbauer
Copy link
Author

Oh I know why now. This is because generator-code lacks main/files in package.json but generator-npm has it. This is a shortcoming with the VS Code generator then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant