Error when trying to import
Closed this issue ยท 11 comments
I'm not sure that's happening because of my component. If you remove the import InputTag from 'vue-input-tag'
that error goes away?
I try to import InputTag from 'vue-input-tag'
in my component and get this error:
ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-input-tag/src/InputTag.vue
Module build failed: Error: Couldn't find preset "stage-2" relative to directory "/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/vue-input-tag"
at /Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:292:19
at Array.map (native)
at OptionManager.resolvePresets (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:274:20)
at OptionManager.mergePresets (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:263:10)
at OptionManager.mergeOptions (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:248:14)
at OptionManager.init (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
at File.initOptions (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/devuser/Documents/Vue.JS/vue-myproject/node_modules/babel-loader/lib/index.js:38:20)
@ ./~/vue-input-tag/src/InputTag.vue 7:2-94
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/customers/Tags.vue
@ ./src/components/customers/Tags.vue
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/customers/Edit.vue
@ ./src/components/customers/Edit.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
@l0rda: Same issue; I just ran npm install --save-dev babel-preset-stage-2
and it compiled. Try that?
same behavior with
Module build failed: ReferenceError: Unknown plugin "transform-runtime" specified in "...../node_modules/vue-input-tag/.babelrc"
need to do
npm install --save-dev babel-plugin-transform-runtime
I have a similar issue importing this into a project that doesn't use vue-loader. Is it intended to be usable from outside of vue-loader projects? Currently it doesn't seem possible.
Great library btw, really want to use it.
Also having the transform runtime error in a Laravel project that has vue installed.
It would be awesome to use the library on whatever the environment is set.
The problem in Laravel is the babel dependencies that are not included (babel-plugin-transform-runtime, babel-preset-es2015, babel-preset-stage-2).
The simplest solution is to move those to deps instead of dev-deps in package.json.
The manual solution install those on the Laravel project or whatever the environment is.
And the best solution is to write the library to not depend on those babel utilities.
Hope this can help.
I have a similar problem, after I ran this npm install vue-input-tag --save
and pasted the import InputTag from 'vue-input-tag'
into bootstrap.js
file (in my laravel 5.4 project) I got this error:
Module build failed: ReferenceError: Unknown plugin "transform-runtime" specified in ".../node_modules/vue-input-tag/.babelrc" at 0, attempted to resolve relative to "/home/glakatos/own/codes/webpages/web-chat/node_modules/vue-input-tag"
Could it be the same error as yours?
Yes as I wrote you have to install those deps on your laravel project:
npm install babel-plugin-transform-runtime --save-dev
npm install babel-preset-es2015 --save-dev
npm install babel-preset-stage-2 --save-dev
Tell me if it works.
Thx! It works.