Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'from' of undefined #320

Open
sarbbottam opened this issue Jun 8, 2020 · 7 comments
Open

TypeError: Cannot read property 'from' of undefined #320

sarbbottam opened this issue Jun 8, 2020 · 7 comments

Comments

@sarbbottam
Copy link

/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'
}
@sarbbottam
Copy link
Author

This is strange, I uninstalled the global ember-native-class-codemod and ran with npx, it worked fine.

Copy link
Member

rwjblue commented Jun 8, 2020

In general, I would not advise running globally. Using npx will make sure to get you the latest every time...

@sarbbottam
Copy link
Author

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.

@ballPointPenguin
Copy link

I'm seeing the same error, running as npx ember-native-class-codemod http://localhost:4200 app/controllers/*.js

@ballPointPenguin
Copy link

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.

@gabrielcsapo
Copy link

Is there a reason this won't work when running globally?

@rwjblue
Copy link
Member

rwjblue commented Jan 15, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants