Problem when using generator-rn-toolbox to apply i

2019-08-18 23:04发布

问题:

I use generator-rn-toolbox to set icon and splash screen for my react-native app as instructions - install generator npm install -g yo generator-rn-toolbox
- install brew brew install imagemagick
- generate icons yo rn-toolbox:assets --icon ~/Desktop/logo.png
Then I encountered an error as below

internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'universal-analytics'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-rn-toolbox/analytics.js:1:74)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-rn-toolbox/generators/assets/index.js:5:19)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)

I tried to run npm install universal-analytics but it doesn't work. Do you have any solutions?

回答1:

I solved by

  1. npm remove -g yo generator-rn-toolbox

  2. npm install -g yo generator-rn-toolbox

We look forward to helping you