1:1 error Resolve error: Cannot find module '/Users/zeroliu/Developer/Advanced-React/sick-fits/frontend/node_modules/enzyme/build'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:323:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:680:18)
at findModulePath (/Users/zeroliu/Developer/Advanced-React/sick-fits/frontend/node_modules/eslint-import-resolver-alias/index.js:100:27)
It works for other packages. The error goes away if I stop importing enzyme or remove eslint-import-resolver-alias from my pipeline. Looking at enzyme package.json, its "main" property is set to "build" folder, which is different from most NPM packages that use a js file as entry. According to the call stack, I believe the problem is caused by calling the private __findPath method directly.
When using eslint-import-resolver-alias with enzyme, it throws an error.
It works for other packages. The error goes away if I stop importing enzyme or remove eslint-import-resolver-alias from my pipeline. Looking at enzyme package.json, its "main" property is set to "build" folder, which is different from most NPM packages that use a js file as entry. According to the call stack, I believe the problem is caused by calling the private
__findPath
method directly.I'm not quite familiar with the internal implementation of node module. Please help.
For now, there are these workarounds:
map enzyme to a random path.
update enzyme package.json main to "build/index.js"
Option 1 is probably better since we don't want to touch third party packages.