vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题

今天下载了一个开源项目一直运行不了,折腾了半天才找到问题所在,config目录下缺少了index.js文件导致的

liurongliurong/vue: vue框架编写的数字碳交易所
https://github.com/liurongliurong/vue

18 verbose node v10.1.0
19 verbose npm v6.5.0
20 error code ELIFECYCLE
21 error errno 1
22 error carbon@1.0.0 dev: `node server`
22 error Exit status 1
23 error Failed at the carbon@1.0.0 dev script.

错误日志:提示npm要6.5.0的,查询下

>npm -version
5.6.0

升级命令:npm install -g npm

升级后仍然是不行,后面发现原来是config目录下缺少index.js导致的,应该是开源作者漏传了这个文件。

index.js内容可以随便拷贝另外一个项目的过来修改,本人测试可以用的内容如下:

'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation. const path = require('path') module.exports = {
dev: { // Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {}, // Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8088, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- /**
* Source Maps
*/ // https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map', // If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true, cssSourceMap: true
}, build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'), // Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/', /**
* Source Maps
*/ productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map', // Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}

===============

安装慢的问题可以切换到淘宝镜像命令:npm install -g cnpm --registry=http://registry.npm.taobao.org

之后所有用到的 npm 命令都可以使用 cnpm 来代替进行 install。但是 cnpm 不支持 publish 命令,需要注意。

https://npm.taobao.org/

vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题的更多相关文章

  1. vue项目启动报错 spawn cmd ENOENT errno: -4058

    vue项目启动报错 spawn cmd ENOENT errno: -4058 运行vue项目(npm run dev)报错 提示 'npm' 不是内部或外部命令 cmd输入node -v 有版本号 ...

  2. 关于ActiveMQ+Zookeeper做集群时,解决启动报错:java.io.IOException: com/google/common/util/concurrent/internal/InternalFutureFailureAccess

    这个问题我也是无意间碰到的,之前一直是使用单机的ActiveMQ,所以也没这个问题,但是做集群时碰到这个问题,问题是这样子出现的: 首先,我准备了三台虚拟机,然后使用 Replicated Level ...

  3. weblogic10.3 启动报错 Unrecognized option: -jrockit Error: Could not create the Java Virtual Machine

    今天在使用weblogic10.3+jdk7创建domain的时候,建好domain后启动报如下错误信息: Unrecognized option: -jrockitError: Could not ...

  4. Tomcat启动报错:SERVER: Error ListenerStart 排查过程记录

    报错的Tomcat截图:   要排查此问题,首先需要调整tomcat的日志级别,调整成通过log4j来记录日志的方式,具体的调整方式: http://tomcat.apache.org/tomcat- ...

  5. vue项目启动报错You may use special comments to disable some warnings.

    在build/webpack.base.conf.js文件中,注释或者删除掉:...(config.dev.useEslint ? [createLintingRule()] : []),

  6. fastDfs V5.02 升级到 V5.08版本后,启动报错:symbol lookup error: /usr/bin/fdfs_trackerd: undefined symbol: g_current_time

    /libfastcommon-1.0.36 # ./make.sh cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o hash.o ...

  7. Eclipse启动报错[ out of memory error has occurred ]或[ An internal error occurred while showing an internal error ]

    自我总结,有什么需要纠正或更好的方案,请告知,谢谢! 最近上来看到好多同学都遇到了这个问题,之前我也好几次碰到这个问题,很是恼火,什么没干,eclipse一开电脑就卡死了,后来发现不管是新打开ecli ...

  8. Eclipse启动报错:An internal error occurred during: "Initializing Java Tooling".

    An internal error occurred during: "Initializing Java Tooling".java.lang.NullPointerExcept ...

  9. 解决vue安装less报错Failed to compile with 1 errors的问题

    1.创建vue项目后安装less,执行 npm install less less-loader --save-dev 下载版本为:less-loader@6.1.0 , less@3.11.3,重启 ...

随机推荐

  1. 【BZOJ4025】二分图

    Description 神犇有一个n个节点的图.由于神犇是神犇,所以在T时间内一些边会出现后消失.神犇要求出每一时间段内这个图是否是二分图.这么简单的问题神犇当然会做了,于是他想考考你. Input ...

  2. Linux下">/dev/null 2>&1 "相关知识说明

    在学习Linux的过程中,常会看到一些终端命令或者程序中有">/dev/null 2>&1"出现,由于已经遇到了好几次了,为了理解清楚,不妨花点时间百度或者go ...

  3. 使用DDL触发器同步多个数据库结构

    使用DDL触发器同步多个数据库结构 背景:当开发组比较大时,势必会分布到不同的地理位置,若无法在同一个快速网络中工作,就会造成多个开发库并存的局面,这样就需要多个开发库结构的同步,甚至是开发测试数据的 ...

  4. git使用——推送本地文件到远程仓库

    捣鼓了一下午之后总结如下:   1.首先可以照着这个链接里面博主给出的详细方法进行操作和配置: http://www.open-open.com/lib/view/open1454507333214. ...

  5. sanchi

    修炼之路阶段1能简单处理html+css+js前端页面,可实现管理后台前端页面 熟练安装php的web运行环境,并调整配置,会自行安装php扩展 熟练数据库操作,清楚为何使用pdo而不使用mysql等 ...

  6. vue2中使用 better-scroll

    使用时有三个要点: 一:html部分 <div class="example" ref="divScroll"> <div> <p ...

  7. oracle数据库字符集查询

    1>数据库服务器字符集 select * from nls_database_parameters,其来源于props$,是表示数据库的字符集. 查询结果如下 NLS_LANGUAGE AMER ...

  8. 异常HTTP Status 500 - Illegal access to constructor, is it public? java.lang.IllegalAccessException: Class com.opensymphony.xwork2.ObjectFactory can not access a member of class action.CoreAction with

    Exception report message Illegal access to constructor, is it public? description The server encount ...

  9. HR在ERP实施过程中的作用

    ERP实施涉及到部门职责.个人职责的改变,在实施过程中HR有着不可估量的作用: 实施制度设计 包括如何对实施人员的激励,对实施人员进行合理的岗位职责调整: 某些企业在实施ERP时自项目经理到关键用户都 ...

  10. 中国标准时间转换成YYY-MM-DD

    export function changeDate(dateA) { let date; if (dateA) { if (dateA.toString().indexOf('GMT') > ...