编译直接失败了,vue serve 命令编译的

来源:4-2 单页面应用Demo1

林水吉

2019-01-22 16:22

Failed to compile.

./demo1.vue?vue&type=script&lang=js& (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/babel-loader/lib??ref--12-0!/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/vue-loader/lib??vue-loader-options!./demo1.vue?vue&type=script&lang=js&) Module build failed (from /Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-es2015' from '/Users/wubinbin/workstation'     at Function.module.exports [as sync] (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/resolve/lib/sync.js:58:15)     at resolveStandardizedName (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/files/plugins.js:101:31)     at resolvePreset (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/files/plugins.js:58:10)     at loadPreset (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/files/plugins.js:77:20)     at createDescriptor (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)     at items.map (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)     at Array.map (<anonymous>)     at createDescriptors (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)     at createPresetDescriptors (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)     at presets (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)     at mergeChainOpts (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-chain.js:320:26)     at /Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-chain.js:283:7     at buildRootChain (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/config-chain.js:120:22)     at loadPrivatePartialConfig (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/partial.js:85:55)     at Object.loadPartialConfig (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/@babel/core/lib/config/partial.js:110:18)     at Object.<anonymous> (/Users/wubinbin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli-service-global/node_modules/babel-loader/lib/index.js:140:26)

写回答 关注

1回答

  • Brian
    2019-01-23 08:50:20
    已采纳

    全局安装了@vue/cli工具了吗?

    npm install -g @vue/cli
    # OR
    yarn global add @vue/cli

    如需要使用快速原型开发,还需要

    npm install -g @vue/cli-service-global

    然后再次尝试。


    参考资料:快速原型开发

    林水吉 回复Brian

    cnpm install --save babel-preset-es2015 用了这个命令就好了

    2019-01-23 16:36:36

    共 5 条回复 >

3小时速成 Vue2.x 核心技术

带你快速学习最流行的前端框架vue2.x的核心技术

82578 学习 · 489 问题

查看课程

相似问题