请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册
搜索

npm run build 开源的快应用 报错

8
回复
117
查看
[复制链接]

1

主题

4

帖子

0

积分

 楼主| 2018-3-30 16:46:51 显示全部楼层 |阅读模式
错误如下:
module.js:478
    throw err;
    ^


Error: Cannot find module '/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/hap-tools/webpack.config.js'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at module.exports (/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/webpack/bin/webpack.js:39:40)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}span.s1 {font-variant-ligatures: no-common-ligatures}
    at tryModuleLoad (module.js:453:12)


请问这是什么原因?
回复

使用道具 举报

1

主题

4

帖子

0

积分

 楼主| 2018-3-30 16:49:20 显示全部楼层
有没有人碰到过这个错误?
完整的错误日志:
> quickapp-wechat@1.0.0 build /Users/***/Desktop/WebStormProject/quickapp-wechat-master
> cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js


module.js:478
    throw err;
    ^


Error: Cannot find module '/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/hap-tools/webpack.config.js'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at module.exports (/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/webpack/bin/webpack.js:39:40)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)


npm ERR! Darwin 17.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.13.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! quickapp-wechat@1.0.0 build: `cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the quickapp-wechat@1.0.0 build script 'cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the quickapp-wechat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_PLATFORM=na NODE_PHASE=dv webpack --config ./node_modules/hap-tools/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs quickapp-wechat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls quickapp-wechat
npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #990000; background-color: #000000}span.s1 {font-variant-ligatures: no-common-ligatures}span.s2 {font-variant-ligatures: no-common-ligatures; color: #bfbfbf; background-color: #000000}span.s3 {font-variant-ligatures: no-common-ligatures; color: #990000; background-color: #000000}span.s4 {font-variant-ligatures: no-common-ligatures; color: #d53bd3}span.s5 {font-variant-ligatures: no-common-ligatures; color: #bfbfbf}span.s6 {font-variant-ligatures: no-common-ligatures; color: #000000; background-color: #ffffff}
npm ERR!     /Users/***/Desktop/WebStormProject/quickapp-wechat-master/npm-debug.log
回复

使用道具 举报

2

主题

5

帖子

0

积分

2018-3-30 16:56:25 显示全部楼层
Cannot find module '/Users/***/Desktop/WebStormProject/quickapp-wechat-master/node_modules/hap-tools/webpack.config.js'
回复

使用道具 举报

3

主题

6

帖子

0

积分

2018-3-30 17:04:34 显示全部楼层
npm update --force
回复

使用道具 举报

5

主题

13

帖子

0

积分

2018-3-30 17:06:48 显示全部楼层
试试执行 npm update --force
然后再npm run build


不行的话你看看是不是你环境没搭建好,可参考我这篇文章:
从零开始,快速创建第一个快应用  
回复

使用道具 举报

1

主题

4

帖子

0

积分

 楼主| 2018-3-30 18:02:03 显示全部楼层
我运行官方默认的demo是正常的,说明环境是正常的
回复

使用道具 举报

1

主题

4

帖子

0

积分

 楼主| 2018-3-30 18:09:03 显示全部楼层
先npm install hap-tools,再npm run build就正常了
回复

使用道具 举报

0

主题

1

帖子

0

积分

2018-4-2 16:33:41 显示全部楼层
我也是这个错误,不知道是不是node版本太高的原因?
回复

使用道具 举报

0

主题

2

帖子

10

积分

2019-1-4 16:35:25 显示全部楼层
[INFO] 配置环境:{"NODE_PLATFORM":"native","NODE_PHASE":"dev"}
[LOG] ### App Loader ### build目录构建完成
[LOG] ### App Loader ### 复制 rpk 文件(com.douyu.quickapp.debug.rpk)为文件(com.douyu.quickapp_debug_8_20190104043350.rpk)
[INFO] Build Time Cost: 0.782s
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\About'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\Components'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\Components'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\Components'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\Home'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\LiveDetail'
[ERRO] Module not found: Error: Can't resolve 'babel-loader' in 'G:\d\QADouyu\src\LiveList'
[LOG] ### App Loader ### 请求手机自动刷新
[LOG] Command failed: cd C:\Users\pengleigang\AppData\Roaming\npm\node_modules\hap-toolkit\lib\server && node ./command/notify.js
module.js:471
    throw err;
    ^

Error: Cannot find module 'G:\d\QADouyu\command\notify.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

[LOG] module.js:471
    throw err;
    ^

Error: Cannot find module 'G:\d\QADouyu\command\notify.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册