Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Undefined Property 'typescript' in dev-cli if devDependencies is missing #143

Open
Warchant opened this issue Apr 21, 2020 · 0 comments
Open

Comments

@Warchant
Copy link

Warchant commented Apr 21, 2020

My project uses lerna. When I execute lerna link convert - it removes all devDependencies from my packages.

Then, if I run task oclif-dev readme, it fails with this error:

wrote manifest to /home/bogdan/tools/nodecore-js/packages/ncjs-cli/oclif.manifest.json
replacing <!-- usage --> in README.md
TypeError: Cannot read property 'typescript' of undefined
    at Readme.commandPath (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:189:42)
    at Readme.commandCode (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:137:32)
    at Readme.renderCommand (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:122:18)
    at ~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:110:39
    at Array.map (<anonymous>)
    at Readme.commands (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:110:25)
    at Readme.run (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/dev-cli/lib/commands/readme.js:36:123)
    at async Readme._run (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/command/lib/command.js:42:20)
    at async Config.runCommand (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/config/lib/config.js:172:9)
    at async Main.run (~/tools/nodecore-js/packages/ncjs-cli/node_modules/@oclif/command/lib/main.js:21:9)
lerna info lifecycle ncjs-cli@1.4.1~prepack: Failed to exec prepack script
lerna ERR! lifecycle "prepack" errored in "ncjs-cli", exiting 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is because here
https://github.com/oclif/dev-cli/blob/master/src/commands/readme.ts#L197
and
https://github.com/oclif/dev-cli/blob/master/src/commands/readme.ts#L208
no 'undefined' check.

Once I added empty devDependencies - command worked.

Maybe use elvis operator or add undefined guards?

Version: oclif/1.15.2 linux-x64 node-v13.12.0

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

1 participant