Closed cmalard closed 9 years ago
What version of Eslint-nibble are you using? In recent versions I am precompiling, so babel should not be required at all.
Latest, 0.1.0 :-)
The file https://github.com/IanVS/eslint-nibble/blob/master/index.js make a call to
require("babel/polyfill");
Ah ha. I must have missed that when I transitioned from using the Babel require hook to precompiling. Thanks for the catch!
I can't make a fix until tonight, is there any chance you can submit a PR to remove that line and the commented-out line above it? To test, you can npm link
in the eslint-nibble directory, and then npm link eslint-nibble
inside a project folder for symlinking into that project.
Are people still seeing this error? It's the top visited page in the repo.
@IanVS I came here through Google because of the line "Cannot find module 'babel/polyfill'". It's unrelated to your library but is one of the top Google results for that error.
Aye, I found it through a Google search also "Error: Cannot find module 'babel/polyfill'"
Oli
to resolve this need to run below npm install
npm install --save-dev babel-polyfill
@brajeshyadav84 Still getting the error even when it is installed.
Any quick fixes?
@basickarl is the error coming from eslint-nibble
? Can you please post the error's stack trace?
@IanVS Here ya go bud. Most likely babel.
karl@karl-ux303ln:~/dev/sketch/experiment/socketio$ node src/start-app.js
module.js:442
throw err;
^
Error: Cannot find module 'babel-core/polyfill'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/karl/dev/sketch/experiment/socketio/src/start-app.js:3:1)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
package.json
...
"devDependencies": {
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-stage-3": "^6.11.0",
"babel-register": "^6.11.6",
...
start-app.js
require('babel-core/polyfill');
require('babel-core/register');
require('./app');
I did however fix the error by replacing require('babel-core/polyfill');
with require('babel-polyfill');
. So if anyone else ends up here (babel related or eslint-nibble related), hope this helps.
This thread also helped: http://stackoverflow.com/a/33568284/1137669 apparantly it has changed in v6 as stated.
This is not related to this package. But, it looks like you've installed
babel-polyfill but are trying to require polyfill from babel-core. I
believe you need to change your require to require('babel-polyfill')
.
Same for babel-register as well.
On Sat, Sep 3, 2016, 11:53 Karl Morrison notifications@github.com wrote:
@IanVS https://github.com/IanVS Here ya go bud.
karl@karl-ux303ln:~/dev/sketch/experiment/socketio$ node src/start-app.js module.js:442 throw err; ^
Error: Cannot find module 'babel-core/polyfill' at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object.
(/home/karl/dev/sketch/experiment/socketio/src/start-app.js:3:1) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) package.json
... "devDependencies": { "babel-polyfill": "^6.13.0", "babel-preset-es2015": "^6.13.2", "babel-preset-stage-3": "^6.11.0", "babel-register": "^6.11.6", ...
start-app.js
require('babel-core/polyfill'); require('babel-core/register');
require('./app');
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IanVS/eslint-nibble/issues/6#issuecomment-244554158, or mute the thread https://github.com/notifications/unsubscribe-auth/AEZyAXHkgAnWA3lCx8ZezIiX-zSnVzdlks5qmZfdgaJpZM4FVPvi .
to resolve this, i ran the line below
npm install --save-dev babel-polyfill
Then, I imported the file in my main entry "App.js".
require("babel-polyfill");
If you are not not, try navigating you "node_modules" folder and search for "node_modules\babel-polyfill"
Strings below helped me to solve the issue
npm install --save @babel/polyfill
import "@babel/polyfill";
Note that it should be installed as a dependency
, not a devDependency
(because it runs before our source code).
And a @
symbol should be present for the last babel version.
@lloydbanks and @nywooz are you having this error when using eslint-nibble? If so, would you mind please opening another issue? Otherwise, I think as mentioned above this issue is ranking on Google and drawing in folks having issues in other projects. For that reason I'm going to lock this thread. But if you've come here from Google, you might as well check out what eslint-nibble can do for you, and maybe it'll be useful. :)
Hello,
Babel is actually required to run eslint-nibble, so it fails if Babel is not installed with this error :