1

安装了最新版本的Node.Js()和 npm 包**(1.2.10)** 当我运行 express 命令生成项目时,它会抛出以下错误

buffer.js:240
  switch (encoding && encoding.toLowerCase()) {
                               ^
TypeError: Object #<Object> has no method 'toLowerCase'
    at Function.Buffer.isEncoding (buffer.js:240:32)
    at assertEncoding (fs.js:98:27)
    at Object.fs.writeFileSync (fs.js:908:3)
    at write (/usr/local/lib/node_modules/express-generator/bin/express:273:6)
    at /usr/local/lib/node_modules/express-generator/bin/express:233:5
    at /usr/local/lib/node_modules/express-generator/bin/express:288:11
    at /usr/local/lib/node_modules/express-generator/node_modules/mkdirp/index.js:47:26
    at Object.oncomplete (fs.js:93:15)
    at process._makeCallback (node.js:321:24)
4

1 回答 1

0

使用此命令由 Build 升级,并且可以正常工作

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable
Reinstall Express and Express-Generator 
sudo npm install -g express
sudo npm install -g express-generator
于 2015-01-22T16:56:46.697 回答