npm run build ERROR in static/js/vendor.e475838be75c71f87b37.js from UglifyJs

简介: 一个 vue2.0 项目,执行 npm run dev 正常,但是 npm run build 出现打包错误。

一个 vue2.0 项目,执行 npm run dev 正常,但是 npm run build 出现打包错误,

xxx@xxx:~/xxx/src/frontend$ npm run build 
> test@1.0.0 build /home/xxx/src/frontend
> node build/build.js
Hash: 4003cde5faa0b066a0a7
Version: webpack 3.8.1
Time: 8660ms
                                              Asset       Size  Chunks                    Chunk Names
           static/js/vendor.e475838be75c71f87b37.js    1.72 MB       0  [emitted]  [big]  vendor
              static/js/app.bf4b159892d6feccb271.js    13.6 kB       1  [emitted]         app
         static/js/manifest.01542bfecf9357fb0249.js    1.49 kB       2  [emitted]         manifest
static/css/app.9746d34b80301e3f963132f72e9f5f23.css     106 kB       1  [emitted]         app
       static/js/vendor.e475838be75c71f87b37.js.map    2.13 MB       0  [emitted]         vendor
          static/js/app.bf4b159892d6feccb271.js.map    68.5 kB       1  [emitted]         app
     static/js/manifest.01542bfecf9357fb0249.js.map    14.2 kB       2  [emitted]         manifest
                                         index.html  829 bytes          [emitted]         
ERROR in static/js/vendor.e475838be75c71f87b37.js from UglifyJs
Unexpected token: name (Simple) [./node_modules/cbor/lib/simple.js:9,0][static/js/vendor.e475838be75c71f87b37.js:4155,6]
  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the test@1.0.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!     /home/xxx/.npm/_logs/2017-10-27T07_45_42_739Z-debug.log


cbor 包导致的错误

解决方式 :

webpack.base.conf.js 中找到 rules 修改 test: /\.js$/ 内容如下

{
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/cbor')]
 },


目录
相关文章
Nuxt.js run build 之后生成的 dist 文件夹在哪
Nuxt.js run build 之后生成的 dist 文件夹在哪
437 0
|
小程序
小程序wepy踩坑-Cannot find module 'D:\node_modules\npm\bin\npm-cli.js'
小程序wepy踩坑-Cannot find module 'D:\node_modules\npm\bin\npm-cli.js'
241 0
|
5月前
|
JavaScript
This dependency was not found:* vue/types/umd in ./src/router/index.jsTo install it, you can run
This dependency was not found:* vue/types/umd in ./src/router/index.jsTo install it, you can run
This dependency was not found:* vue/types/umd in ./src/router/index.jsTo install it, you can run
|
7月前
|
应用服务中间件 nginx
Angular打包构建项目服务器运行runtime.js、polyfills.js、vendor.js报错net::ERR_ABORTED 404 (Not Found),build修改为相对路径./
Angular打包构建项目服务器运行runtime.js、polyfills.js、vendor.js报错net::ERR_ABORTED 404 (Not Found),build修改为相对路径./
vue-element-admin里面使用npm run build:prod打包步骤
vue-element-admin里面使用npm run build:prod打包步骤
189 1
|
7月前
|
JavaScript
npm run build ERROR in static_js_vendor.e475838be75c71f87b37.js from UglifyJs
npm run build ERROR in static_js_vendor.e475838be75c71f87b37.js from UglifyJs
112 0
|
JavaScript
Vue报错:npm run start npm ERR! missing script: start
Vue报错:npm run start npm ERR! missing script: start
|
Web App开发 JavaScript
vue踩坑-Error: Can't resolve 'sass-loader' in 'E:\Element-UI-master\src\components'
vue踩坑-Error: Can't resolve 'sass-loader' in 'E:\Element-UI-master\src\components'
138 0
|
JavaScript 前端开发 API
vite.config.js 无法使用__dirname的解决方法
在使用 vite 的时候发现,在其 vite.config 文件中无法使用 __dirname 来代表当前目录,所有经过一番了解之后有了这篇文章。
746 0
|
JavaScript
【3】npm run build Vue的项目,如何修改相对路径配置
【3】npm run build Vue的项目,如何修改相对路径配置