TypeError: Cannot read property 'from' of undefined
/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/@babel/core/lib/transformation/index.js:66
throw e;
^
TypeError: /usr/local/lib/node_modules/ember-native-class-codemod/node_modules/safe-buffer/index.js: Cannot read property 'from' of undefined
at Converter.toBase64 (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/convert-source-map/index.js:61:28)
at Converter.toComment (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/convert-source-map/index.js:65:21)
at generateCode (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/@babel/core/lib/transformation/file/generate.js:78:76)
at run (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/@babel/core/lib/transformation/index.js:55:33)
at run.next (<anonymous>)
at Function.transform (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/@babel/core/lib/transform.js:27:41)
at transform.next (<anonymous>)
at evaluateSync (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/gensync/index.js:244:28)
at Function.sync (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/gensync/index.js:84:14)
at Object.transform (/usr/local/lib/node_modules/ember-native-class-codemod/node_modules/@babel/core/lib/transform.js:36:54) {
code: 'BABEL_GENERATE_ERROR'
}
This is strange, I uninstalled the global ember-native-class-codemod and ran with npx, it worked fine.
In general, I would not advise running globally. Using npx will make sure to get you the latest every time...
I am running the code mod on a smaller subset of files. Since this codemod needs to install chromium, every npx execution is taking substantially longer.
Also, I installed the codemod globally just a few minutes prior to the npx run.
I'm seeing the same error, running as npx ember-native-class-codemod http://localhost:4200 app/controllers/*.js
Similarly I installed a fresh node version with nvm (12.18.3) and ran again with npx and it works! It does seem like clearing the global modules may be the reason it's working for me.
Is there a reason this won't work when running globally?
Is there a reason this won't work when running globally?
No, but there are combinations of conflicting versions that folks hit which is not an issue when using npx (vs a permanent global install). I think volta install would also probably work just fine, but haven't tried it.