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

nest g controller error #1394

Closed
kgish opened this issue Dec 22, 2018 · 6 comments
Closed

nest g controller error #1394

kgish opened this issue Dec 22, 2018 · 6 comments

Comments

@kgish
Copy link

kgish commented Dec 22, 2018

When I try running the command:

nest g controller operator

I get the following error:

TypeError: Cannot read property 'text' of undefined
    at Object.getTokenPosOfNode (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/typescript/lib/typescript.js:7515:72)
    at IdentifierObject.TokenOrIdentifierObject.getStart (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/typescript/lib/typescript.js:94997:23)
    at IdentifierObject.TokenOrIdentifierObject.getText (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/typescript/lib/typescript.js:95018:77)
    at node.properties.filter.filter (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@nestjs/schematics/utils/metadata.manager.js:18:33)
    at Array.filter (<anonymous>)
    at MetadataManager.insert (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@nestjs/schematics/utils/metadata.manager.js:14:14)
    at ModuleMetadataDeclarator.declare (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@nestjs/schematics/utils/module-metadata.declarator.js:7:34)
    at ModuleDeclarator.declare (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@nestjs/schematics/utils/module.declarator.js:14:33)
    at /home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@nestjs/schematics/lib/controller/controller.factory.js:58:51
    at MergeMapSubscriber.input.pipe.operators_1.mergeMap.inputTree [as project] (/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/@angular-devkit/schematics/src/rules/call.js:74:24)
Failed to execute command: "/home/kiffin/.nvm/versions/node/v8.9.3/lib/node_modules/@nestjs/cli/node_modules/.bin/schematics" @nestjs/schematics:controller --name=operator --no-dry-run --spec --language="ts" --sourceRoot="src"
@shajeeck
Copy link

shajeeck commented Dec 23, 2018

i am also getting an error when trying to follow the docs with nes g co cats any fix?

Error: Cannot find module 'typescript'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (-------------------X\node_modules\@nestjs\cli\node_modules\@nestjs\schematics\utils\metadata.manager.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Failed to execute command: "-------------------X\node_modules\@nestjs\cli\node_modules\.bin\schematics" @nestjs/schematics:controller --name=cats --no-dry-run --spec --language="ts" --sourceRoot="src"

@shajeeck
Copy link

After installing typescript globally i was able to generate controller
npm install -g typescript

@kgish your issue might be something else!

@kgish
Copy link
Author

kgish commented Dec 24, 2018

After installing typescript globally i was able to generate controller
npm install -g typescript

@kgish your issue might be something else!

Worked, thanks!

@shajeeck
Copy link

You can consider closing this issue if its resolved

@kgish kgish closed this as completed Dec 24, 2018
@CommerceOwl
Copy link

I recommend opening this issue again since npm install -g typescript should be part of the documentation or it should be run by new new PROJECT command.

@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants