[英]babel.config.js: Error while loading config - Cannot find module 'fibers'
This is driving me nuts.这让我发疯了。
IDE: Visual Studion 2019 Project: Created a new "Basic Vue.js project" - I chose the *.ts flavour IDE:Visual Studion 2019 项目:创建了一个新的“基本 Vue.js 项目”——我选择了 *.ts 风格
I validate the new site runs.我验证了新站点的运行。 It does.
确实如此。
Following the quick start on Vuetify: https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object在 Vuetify 快速入门之后: https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object
After each step I validate the site will still compile and run.在每一步之后,我都会验证该站点仍将编译和运行。
I reach the section where we add new modules to our project.我到达了我们向项目添加新模块的部分。 I run this line:
我运行这条线:
npm install sass sass-loader fibers deepmerge -D
And now the site will not run.现在该网站将无法运行。 When I debug I get this output:
当我调试时,我得到这个 output:
------ Build started: Project: MCCC.Web, Configuration: Debug Any CPU ------
> mccc.web@0.1.0 build C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web
> vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors5:04:50 PM
error in ./src/main.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js:17:32)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
@ multi ./src/main.ts
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mccc.web@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mccc.web@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dwainwright.BC\AppData\Roaming\npm-cache\_logs\2020-04-26T21_04_50_521Z-debug.log
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(60,5): error MSB3073: The command "npm run build" exited with code 1.
Done building project "MCCC.Web.njsproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line that sticks out the most to me is:最让我印象深刻的一句话是:
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
fibres is references in the babel.config.json where I added the rules laid out in quick start:纤维是 babel.config.json 中的引用,我在其中添加了快速入门中列出的规则:
module.exports = {
presets: [
'@vue/app',
'@babel/preset-env'
],
rules: [
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader@^7.0.0
options: {
implementation: require('sass'),
fiber: require('fibers'),
indentedSyntax: true // optional
},
// Requires sass-loader@^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
]
};
Does anybody know how i can resolve this?有谁知道我该如何解决这个问题? Happy to share further info;
很高兴分享更多信息; not sure what else you may need.
不确定您可能还需要什么。
Are you using the latest version of the docs?您使用的是最新版本的文档吗? I followed the link you provided and the anchor
#bootstrapping-the-vuetify-object
doesn't appear to exist anymore.我按照您提供的链接进行操作,并且锚
#bootstrapping-the-vuetify-object
似乎不再存在。 I was able to get a basic project up and running successfully following these steps:按照以下步骤,我能够成功启动并运行一个基本项目:
vue create myapp
: Selected "custom" and ticked all the boxes, for TypeScript, chose the default "class-style components" vue create myapp
:选择“自定义”并勾选所有框,对于 TypeScript,选择默认的“类样式组件”npm run serve
workednpm run serve
有效vue add vuetify
: Selected "Configure", and these options: vue add vuetify
:选择“配置”,这些选项:
npm run serve
would run, but I got warnings about type declaration for vuetify/lib
. npm run serve
会运行,但我收到有关vuetify/lib
类型声明的警告。 This answer led me to this FAQ item which made the warnings go away. "vuetify"
to the compilerOptions.types
array in the root tsconfig.json
for the project.) "vuetify"
添加到项目根tsconfig.json
中的compilerOptions.types
数组中。) FWIW, fibers
does not appear to be included in the project at all anymore (searched for "fibers" in package-lock.json
). FWIW,
fibers
似乎不再包含在项目中(在package-lock.json
中搜索“纤维”)。 My babel.config.js
file looks like:我的
babel.config.js
文件看起来像:
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
And vue.config.js
looks like: vue.config.js
看起来像:
module.exports = {
transpileDependencies: [
'vuetify'
]
}
Hope this helps!希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.