Vue-cli: Cannot read property 'android' of undefined

Created on 10 Aug 2018  路  2Comments  路  Source: vuejs/vue-cli

Version

3.0.0-rc.11

Node and OS info

node: v8.11.2/ npm:6.3.0 / OS: macOS 10.13.6

Steps to reproduce

  • npm uninstall vue-cli -g
  • npm install -g @vue/cli
  • vue ui
  • coding...
  • npm run build
  • failed

What is expected?

Building success

What is actually happening?

 ERROR  Failed to compile with 1 errors                                 09:31:42

 error  in ./src/main.js

Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
[BABEL] /Users/xxxxxx/src/main.js: Cannot read property 'android' of undefined (While processing: "/Users/xxxxxx/node_modules/@vue/babel-preset-app/index.js")

    at targetEnvironments.filter.environment (/Users/xxxxxx/node_modules/@babel/preset-env/lib/index.js:75:16)
    at Array.filter (<anonymous>)
    at isPluginRequired (/Users/xxxxxx/node_modules/@babel/preset-env/lib/index.js:74:56)
    at includes.filter.item (/Users/xxxxxx/node_modules/@vue/babel-preset-app/index.js:23:12)
    at Array.filter (<anonymous>)
    at getPolyfills (/Users/xxxxxx/node_modules/@vue/babel-preset-app/index.js:22:19)
    at module.exports (/Users/xxxxxx/node_modules/@vue/babel-preset-app/index.js:94:17)
    at loadDescriptor (/Users/xxxxxx/node_modules/@babel/core/lib/config/full.js:163:14)
    at cachedFunction (/Users/xxxxxx/node_modules/@babel/core/lib/config/caching.js:42:19)
    at loadPresetDescriptor (/Users/xxxxxx/node_modules/@babel/core/lib/config/full.js:233:63)

 @ multi ./src/main.js

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /Users/xxxxxx/.npm/_logs/2018-08-10T01_31_42_860Z-debug.log

How to fix this?

Most helpful comment

es6.array.includes -> es7.array.includes

https://unpkg.com/[email protected]/modules/

All 2 comments

sry, I tried it and found that I was wrong with the configuration.

// babel.config.js
module.exports = {
  presets: [
    ['@vue/app', {
      polyfills: [
        'es6.promise',
        'es6.object.assign',
        'es6.object.keys',
        'es6.array.includes'
      ]
    }
    ]
  ]
}

When I deleted some configurations, the build was successful.

// babel.config.js
module.exports = {
  presets: [
    ['@vue/app', {
      polyfills: [
        'es6.promise'
      ]
    }
    ]
  ]
}

The question now is how to configure polyfills?

es6.array.includes -> es7.array.includes

https://unpkg.com/[email protected]/modules/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BusyHe picture BusyHe  路  3Comments

Akryum picture Akryum  路  3Comments

Gonzalo2683 picture Gonzalo2683  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

joshuajohnson814 picture joshuajohnson814  路  3Comments