Enzyme: Cannot find module 'uuid/v4' from 'Utils.js'

Created on 5 Jul 2017  ยท  6Comments  ยท  Source: enzymejs/enzyme

With [email protected]and [email protected] I get this require error. It seems likely that this relates to #1001 and #998. We are getting this error in multiple projects. cc @lencioni

Cannot find module 'uuid/v4' from 'Utils.js'

npm ls uuid

โ”œโ”€โ”ฌ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”ฌ [email protected]
โ”‚     โ””โ”€โ”ฌ [email protected]
โ”‚       โ””โ”€โ”ฌ [email protected]
โ”‚         โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ”œโ”€โ”ฌ [email protected]
โ”‚   โ”‚ โ””โ”€โ”€ [email protected]
โ”‚   โ””โ”€โ”ฌ [email protected]
โ”‚     โ””โ”€โ”ฌ [email protected]
โ”‚       โ””โ”€โ”ฌ [email protected]
โ”‚         โ””โ”€โ”€ [email protected]  deduped
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”ฌ [email protected]
    โ””โ”€โ”€ [email protected]

If I manually change the Utils.js file from require('uuid/v4') to require('uuid').v4 then it works.

Most helpful comment

Cool same we're now using npm install uuid@^3.1 --save-dev to fix this error on 3 projects that use [email protected]. All 3 use npm@^5.2 as of today. 2 use webpack and 1 uses rollup.

All 6 comments

I'm not sure why https://unpkg.com/[email protected]/v4.js wouldn't work if it's truly at v3.1.0. Can you verify that node_modules/enzyme/node_modules/uuid/v4.js exists, and that node_modules/enzyme/node_modules/uuid/package.json is at v3.1.0?

I'm not sure why either. Yes the v4 file exists and that package path is v3.1.0

I confirmed this same error on node 7.10.0 and 8.1.3 and on npm 4.2.0 and npm 5.0.3

Same error!
Old version of uuid may be pinned in node_modules and will be used by webpack or other bundle tools, although new version is installed in enzyme/node_modules.
I fixed this error by npm install uuid --save to replace the old version in node_modules.

Cool same we're now using npm install uuid@^3.1 --save-dev to fix this error on 3 projects that use [email protected]. All 3 use npm@^5.2 as of today. 2 use webpack and 1 uses rollup.

I don't think this is relevant any more now that we're on v3.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

potapovDim picture potapovDim  ยท  3Comments

modemuser picture modemuser  ยท  3Comments

aweary picture aweary  ยท  3Comments

ivanbtrujillo picture ivanbtrujillo  ยท  3Comments

benadamstyles picture benadamstyles  ยท  3Comments