我试图使用" react-native-nested-stylesheet"来创建嵌套样式表。 (https://github.com/pjjanak/react-native-nested-stylesheets/)但是一旦我安装它就会出现此错误。
Error building DepdendencyGraph:
Error: Naming collision detected: /Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/react-native-nested-stylesheet/node_modules/react-native/packager/react-packager/src/DependencyResolver/haste/polyfills/polyfills.js collides with /Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/polyfills.js
at HasteMap._updateHasteMap (/Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at /Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (/Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/promise/lib/core.js:37:12)
at /Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/promise/lib/core.js:103:15
at flush (/Users/hms-mac/research/react-native/myapp-mock/myapp/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:428:9)
at process._tickCallback (node.js:357:13)
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.0.0
npm ERR! npm v3.3.9
npm ERR! code ELIFECYCLE
npm ERR! myapp@0.0.1 start: `react-native start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp@0.0.1 start script 'react-native start'.
npm ERR! This is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-native start
npm ERR! You can get their info via:
npm ERR! npm owner ls myapp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/hms-mac/research/react-native/myapp-mock/myapp/npm-debug.log
造成这种情况的原因是什么?如果这种情况持续存在,是否有创建嵌套样式表的替代方法?感谢。
答案 0 :(得分:0)
我不会声称完全了解该解决方案。我认为这可能与记录不正确的地址来导航node_modules有关,或者可能是我的watchman版本已过时或损坏。
我通过重新安装watchman并删除/重新创建了node_modules和package-lock.json文件来解决此问题。
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
brew uninstall watchman
npm r -g watchman
npm install watchman
yarn
npm install
react-native link
npm start
其中一些步骤可能比较耗时,但是花了我很长时间,所以我希望它不漏水。
祝你好运。