今天在build项目的时候报:

ReferenceError: resolve is not defined

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yingyi@1.0.0 build: cross-env NODE_ENV=production webpack --progress --hide-modules
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yingyi@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! C:UsersyingyiAppDataRoamingnpm-cache_logs2018-05-21T11_19_19_460Z-debug.log

查了一些文档发现是缺少辅助函数,在webpack的配置文件中加上就好了

function resolve (dir) {
return path.join(__dirname, '..', dir)
}

使用vue-cli+webpack搭建的项目一般都有这个,如果是自己单引入的配置文件可能会报这个错,推荐使用脚手架工具搭建环境。

npm run build报错 ,resolve is not defined的更多相关文章

  1. vue-electron 使用sqlite3数据库,执行npm run build 报错 .NET Framework 2.0 SDK,Microsoft Visual Studio 2005[C:\temp\wechat\node_modules\sqlite3\build\binding.sln]

    问题描述 vue-electron 使用sqlite3数据库,执行npm run build 报错如下: .NET Framework 2.0 SDK,Microsoft Visual Studio ...

  2. vue中执行npm run build报错解决方法?

    遇到了执行npm run build 后报错: [build:js ] Module not found: Error: Can't resolve 'scss-loader' in 'D:\work ...

  3. npm run build报错(npm ERR! code ELIFECYCLE)的解决办法

    具体报错如下图: 环境:centos7 应该node_modules安装问题,我们需要重新安装 rm -rf node_modules rm package-lock.json npm cache c ...

  4. 转载:TypeError: Cannot read property 'compilation' of undefined vue 打包运行npm run build 报错

    转载自:https://www.jianshu.com/p/3f8f60e01797 运行npm run build打包时,报错如下:   我的package.json如下: { ... " ...

  5. 关于npm run build 报错解决方案

    # 特定的错误 ERROR in statics/mobile/js/vendor.cef13a0e680a5bc0d8b3.js from UglifyJsUnexpected token: pun ...

  6. vue2.x 在引用插件的时候,npm run dev跑正常 ,npm run build 报错vue-cli Unexpected token: punc (() [

    这是因为,引用的插件在node_modules里,并不在vue-cli的es6编译范围内,所以语法报错,修改方法:

  7. npm run build 报错 Error: No PostCSS Config found in...

    module.exports = { plugins: [ require('autoprefixer')//自动添加css前缀 ] }; 在项目根目录新建postcss.config.js文件,添加 ...

  8. npm run build报错 No PostCSS Config found in

    在项目根目录新建postcss.config.js文件,并对postcss进行配置: module.exports = { plugins: [ require('autoprefixer')//自动 ...

  9. 巨坑npm run dev 报错 终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build/css/add.p

    Windows10环境 npm run dev 报错  终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build ...

随机推荐

  1. QT学习之窗口部件

    对话框--QDialog 模态对话框与非模态对话框 模态对话框:就是相当于没关闭它之前,不能再和该应用程序的其他窗口进行交互(比如新建项目时弹出的对话框) 非模态对话框:可以与它交互,也可以与该程序中 ...

  2. mysql问题,出现 Cant connect to mysql server on 'localhost'

    莫名其妙的一个问题,这个问题出现在今天,然后查找下,发现需要重启服务器,但是重启也一样,于是关机重启,还是这个现象 ,然后看到 错误提示, 提示my.ini的第21行,产生错误,于是按照路径找到配置文 ...

  3. 搜狐 WEB 标准-前端技术应用规范

  4. idea 启动报错问题

    Artifact SpiderServer:war exploded: Error during artifact deployment. See server log for details. 1. ...

  5. winform 中TextBox只能输入数字

    textBox1.KeyPress+=TextNumber_KeyPress; private void TextNumber_KeyPress(object sender, KeyPressEven ...

  6. js代码定义类代码的领悟

    var Class = {    create: function() {        return function() { this.initialize.apply(this, argumen ...

  7. C# Log4.Net日志组件的应用系列(二)

    引言 Log4Net应该可以说是.NET中最流行的开源日志组件了.在各种项目框架中可以说是必不可少的组成部分.个人认为Log4Net有下面几个优点: 1. 使用灵活,它可以将日志分不同的等级,以不同的 ...

  8. python urllib2 对 http 的 get,put,post,delete

    #GET: #!/usr/bin/env python# -*- coding:utf-8 -*-import urllib2def get():    URL = 'www.baidu.com'   ...

  9. Spring boot整合Mongodb

    最近的项目用了Mongodb,网上的用法大多都是七零八落的没有一个统一性,自己大概整理了下,项目中的相关配置就不叙述了,由于spring boot的快捷开发方式,所以spring boot项目中要使用 ...

  10. 【OCP|052】iZ0-052最新题库及答案整理-第9题

    9.Which is true about the Automatic Diagnostic Repository (ADR)? A) It includes diagnostic data for ...