Storybook: UnhandledPromiseRejectionWarning: Error: Cannot find module 'ts-node'

Created on 17 Apr 2021  路  5Comments  路  Source: nuxt-community/storybook

Version

@nuxtjs/storybook: 4.0.2
nuxt: 2.15.4

Steps to reproduce

Trying to run Storybook on the typescript project:
yarn nuxt storybook

What is Expected?

Successfully build Storybook

What is actually happening?

(node:13016) UnhandledPromiseRejectionWarning: Error: Cannot find module 'ts-node'
- D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js
- D:\mypath\node_modules\@nuxtjs\storybook\dist\cli.js
- D:\mypath\node_modules\@nuxtjs\storybook\bin\nuxt-storybook.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:75:28
    at Generator.next (<anonymous>)
    at D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:4:12)
    at buildNuxt (D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:69:12)
    at D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:40:85
    at Generator.next (<anonymous>)
    at D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:4:12)
    at getStorybookConfig (D:\mypath\node_modules\@nuxtjs\storybook\dist\index.js:39:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:13016) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:13016) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

bug

Most helpful comment

I've solved it by manually install ts-node as dependency of my project.

All 5 comments

I have the same issue, have you found any workaround?

@jankaderabek recently I configured React + Tailwind and I got the same error and it was because I didn't make the craco.config.js file. Seems Storybook is looking for a file and throw an exception but I'm not sure about that. I have tested it on Node version 12 and 14.16.1 and get the same error but I'm working on another project and couldn't spend more time on this issue yet.

I've solved it by manually install ts-node as dependency of my project.

I've solved it by manually install ts-node as dependency of my project.

@jankaderabek thanks, I will test it soon.

Sorry for the late response,
Using Storybook module in a typescript projects requires installing ts-node, I add a warning to prevent this kind of issues.
Thank you for the issue. It will release in next version https://github.com/nuxt-community/storybook/pull/277

Was this page helpful?
0 / 5 - 0 ratings

Related issues

productfrontenddeveloper picture productfrontenddeveloper  路  7Comments

farnabaz picture farnabaz  路  6Comments

homerjam picture homerjam  路  4Comments

altryne picture altryne  路  4Comments

seancolsen picture seancolsen  路  4Comments