在webpack打包小节中,对node的版本是不是有要求?怎么我的一直报错

来源:3-4 Webpack 打包构建工具重构小程序(下)

慕粉4298064

2018-01-03

➜  wechat_pro node ./tasks/build

path.js:28

    throw new TypeError('Path must be a string. Received ' + inspect(path));

    ^


TypeError: Path must be a string. Received [Function]

    at assertPath (path.js:28:11)

    at resolve (path.js:1186:7)

    at _.reduce (/Users/lamb/Documents/wechat_pro/tasks/build.js:20:10)

    at arrayReduce (/Users/lamb/Documents/wechat_pro/node_modules/lodash/lodash.js:704:21)

    at Function.reduce (/Users/lamb/Documents/wechat_pro/node_modules/lodash/lodash.js:9698:14)

    at entry (/Users/lamb/Documents/wechat_pro/tasks/build.js:19:21)

    at Object.<anonymous> (/Users/lamb/Documents/wechat_pro/tasks/build.js:25:20)

    at Module._compile (module.js:635:30)

    at Object.Module._extensions..js (module.js:646:10)

    at Module.load (module.js:554:32)

    at tryModuleLoad (module.js:497:12)

    at Function.Module._load (module.js:489:3)

    at Function.Module.runMain (module.js:676:10)

    at startup (bootstrap_node.js:187:16)

    at bootstrap_node.js:608:3

➜  wechat_pro node -v

v8.9.0

➜  wechat_pro npm -v

5.5.1


写回答

1回答

Scott

2018-01-03

看报错,不是 Node 版本问题,是代码问题,可以把 build 里面的 path 前后及 path 变量打印出出来,看看是不是哪里不对

0
0

开发微信全家桶项目Vue/Node/MongoDB高级技术栈全覆盖

Nuxt/Vue SSR + Koa2 跨栈开发微信公众号+小程序

989 学习 · 401 问题

查看课程