React 360 Command Line Interface
Version 1.1.0
npm -v
6.9.0
The following error appears when doing "npm start"
open browser at http://localhost:8081/index.html
Starting React Native Packager...
error Cannot find module 'metro/src/blacklist'. Run CLI with --verbose flag for more details.
Error: Cannot find module 'metro/src/blacklist'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
at Function.Module._load (internal/modules/cjs/loader.js:539:25)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/yuki-noda/Documents/GitHub/myGit/react-360-test/rn-cli.config.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
An error occurred during the packager process. Exited with code 1.
Look at the packager output above to see what went wrong.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node node_modules/react-360/scripts/packager.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Based on this comment https://github.com/facebook/react-native/issues/20799#issuecomment-415185222 I updated line 4 in rn-cli.config.js from var blacklist = require('metro/src/blacklist'); to var blacklist = require('metro-config/src/defaults/blacklist');
Thank you for the comment @chidinmae .
I tried the same solution from facebook/react-native/issues/21093 but the following warning appears in my terminal window
Starting React Native Packager...
● Validation Warning:
Unknown option "getProjectRoots" with value getProjectRoots() {
return getRoots();
} was found.
This is probably a typing mistake. Fixing it will remove this message.
● Validation Warning:
Unknown option "getBlacklistRE" with value getBlacklistRE() {
return blacklist([
]);
} was found.
This is probably a typing mistake. Fixing it will remove this message.
● Validation Warning:
Unknown option "getAssetExts" with value getAssetExts() {
return ['obj', 'mtl'];
} was found.
This is probably a typing mistake. Fixing it will remove this message.
● Validation Warning:
Unknown option "getPlatforms" with value getPlatforms() {
return ['vr'];
} was found.
This is probably a typing mistake. Fixing it will remove this message.
● Validation Warning:
Unknown option "getProvidesModuleNodeModules" with value getProvidesModuleNodeModules() {
return ['react-native', 'react-360'];
} was found.
This is probably a typing mistake. Fixing it will remove this message.
and shows only a blank page in my browser with the following errors in the console.
index.html:10 GET http://localhost:8081/client.bundle?platform=vr 500 (Internal Server Error)
index.html:13 Uncaught ReferenceError: React360 is not defined
at index.html:13
(anonymous) @ index.html:13
favicon.ico:1 GET http://localhost:8081/favicon.ico 404 (Not Found)
Not sure about this one! The error I got after fixing the rn-cli config was related to watchman and fixed by running brew install watchman. Maybe try npm install metro for this?
Not running npm audit fix helped me.
I found a solution. If you're using react native >= 0.59 change your file name rn-cli.config.js to metro.config.js.
Then change your code, for example:
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
getBlacklistRE() {
return blacklist([
/scripts\/.*/,
]);
},
};
To:
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([/scripts\/.*/])
},
};
Following the documentation from metro.
Having the same issue:
error Cannot find module 'metro/src/blacklist'
Require stack:
var blacklist = require('metro-config/src/defaults/blacklist');
THis resolved my issue too
Will close this issue since it is solved
Most helpful comment
I found a solution. If you're using react native >= 0.59 change your file name
rn-cli.config.jstometro.config.js.Then change your code, for example:
To:
Following the documentation from metro.