NPM start Error: jest-haste-map: Haste module naming collision
The error details when npm run start:
check the start cli in package.json is:
There's one problem here is metro.config.js, this file is working under typescript env.
We need to use rn-cli.config.js.
Because we need to avoid fbjs conflict, the config detail should be:
Ok, let's run npm run start again. The everything runs perfectly.
Loading dependency graph...(node:19540) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: fbjs
Paths: /Users/adam/Example/node_modules/create-react-class/node_modules/fbjs/package.json collides with /Users/adam/Example/node_modules/fbjs/package.json
This error is caused by `hasteImpl` returning the same name for different files.
at setModule (/Users/adam/Example/node_modules/jest-haste-map/build/index.js:569:17)
at workerReply (/Users/adam/Example/node_modules/jest-haste-map/build/index.js:641:9)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:19540) 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(). (rejection id: 2)
(node:19540) [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.
check the start cli in package.json is:
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache --config ./metro.config.js",
There's one problem here is metro.config.js, this file is working under typescript env.
We need to use rn-cli.config.js.
Because we need to avoid fbjs conflict, the config detail should be:
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([/node_modules\/.*\/node_modules\/fbjs\/.*/]),
},
};
Ok, let's run npm run start again. The everything runs perfectly.
Loading dependency graph, done.
Comments
Post a Comment