我是否应该更改env vars以便能够在Windows中的Cygwin下使用npm脚本?
尝试在Windows中使用Cygwin下的npm脚本时,收到以下错误:
module.js:339
throw err;
^
Error: Cannot find module '/cygdrive/c/ProgramData/npm/isparta'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at Object.<anonymous> (C:\ProgramData\npm\node_modules\babel\lib\_babel-node.js:144:25)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
我使用节点v4.2.2和npm 2.14.7。
我运行了以下命令:
babel-node `which isparta` cover --include 'lib/**/*.js' _mocha -- 'test/**/*.spec.js' --reporter spec --ui tdd --recursive
我已经成功安装了isparta,babel-node:
来自cygwin终端的斯巴达:
$ which isparta
/cygdrive/c/ProgramData/npm/isparta
来自windows cmd的斯巴达:
C:\Users>where isparta
C:\ProgramData\npm\isparta
C:\ProgramData\npm\isparta.cmd
来自cygwin终端的babel-node:
$ which babel-node
/cygdrive/c/ProgramData/npm/babel-node
来自windows cmd的babel-node:
C:\Users>where babel-node
C:\ProgramData\npm\babel-node
C:\ProgramData\npm\babel-node.cmd
答案 0 :(得分:0)
你必须将Cygwin路径名转换为windows 1,因为很明显babel-node需要windows pathname:
babel-node `cygpath -w $(which isparta)` cover...