今天在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. python操作mysql数据库系列-安装MySQLdb

    一波三折,先是pip命令出现问题,然后各种方法尝试解决.然后是直接使用pip2命令安装报错,mysql-python库安装再次出现问题.于是使用国内镜像的方式去安装:pip2 install MySQ ...

  2. WordPaster-Joomla_3.4.7-tinymce 4.1.7示例发布

    资源下载:Joomla 3x,   1.1.1. 1.添加wordpaster文件夹 /media/   1.1.2. 2.添加插件文件夹 路径:media/editors/tinymce/plugi ...

  3. Swift & Objc 在同一个项目中的使用

    在WWDC大会中发布了Swift让人眼前一亮.终于加了很多的现代编程语言该有的东西.很早年以前玩C#3.0+的时候这些差不多类似的 已经用的烂熟的东西终于一点一点的在看Swift Programmin ...

  4. 编写高质量代码改善C#程序的157个建议——建议111:避免双向耦合

    建议111:避免双向耦合 双向耦合是指两个类型之间相互引用.下面的代码是一种典型的双向耦合: class A { private B b; public void MethodA() { b.Meth ...

  5. 编写高质量代码改善C#程序的157个建议——建议77: 正确停止线程

    建议77: 正确停止线程 开发者总尝试对自己的代码有更多的控制.例如,“让那个还在工作的线程马上停止下来”.然而,并非我们想怎样就可以怎样的,这至少涉及两个问题. 第一个问题 正如线程不能立即启动一样 ...

  6. [leetcode] 3. Pascal's Triangle

    第三道还是帕斯卡三角,这个是要求正常输出,题目如下: Given numRows, generate the first numRows of Pascal's triangle. For examp ...

  7. Android-事务(Transaction)

    事务就拿转帐的例子来说:两个用户,要么都成功,要么都失败,这样才是安全

  8. Win7 家庭普通版开启超级管理员

    将以下内容copy保存为admin.reg文件 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ ...

  9. 腾讯云通信UserSig生成.Net实现

    腾讯云通信后台生成usersig只有java实现代码.以下是根据java代码转换为net实现,java版GitHub地址:https://github.com/TencentVideoCloudMLV ...

  10. 菜鸟的Xamarin.Forms前行之路——从新建项目到APP上架各种报错问题解决方法合集(不定时更新)

    出自:博客园-半路独行 原文地址:http://www.cnblogs.com/banluduxing/p/7425791.html 本文出自于http://www.cnblogs.com/banlu ...