错误的ERR!在start.cmd路径必须是一个字符串 - 节点

时间:2016-06-17 19:08:03

标签: node.js npm

我无法理解为什么我的开始npm脚本cmd在我的Mac上显示此错误:

path.js:8
    throw new TypeError('Path must be a string. Received ' +
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.join (path.js:479:5)
    at Object.<anonymous> (/Users/romain/Desktop/Sources/com.controller.nodejs/central/app.js:16:23)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/romain/Desktop/Sources/com.controller.nodejs/central/bin/www:7:11)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.4.1
npm ERR! npm  v3.9.6
npm ERR! code ELIFECYCLE
npm ERR! central@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the central@0.0.0 start script 'node ./bin/www'.
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 central package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www

它在PC上运行良好...命令脚本是

SET html=../../com.view.html&& npm start

运行npm start时出现相同的错误

1 个答案:

答案 0 :(得分:0)

我认为你必须使用export命令代替set在Unix系统上设置环境变量。