安装了最新版本的 Node.Js()和npm package **(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)
答案 0 :(得分: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