离子节点错误:路径必须是字符串。收到{[String:

时间:2017-04-17 11:17:14

标签: node.js cordova ionic-framework

我在尝试构建离子应用程序时遇到问题 这个错误

SyntaxError: Use of const in strict mode

我认为问题是节点版本,所以我安装了最新版本

当我尝试运行:ionic build android

Error: Path must be a string. Received { [String:
 'C:\\PROGRAM FILES\\NODEJS\\NO
DE.EXE']
  stdout: 'C:\\PROGRAM FILES\\NODEJS\\NODE.EXE',
  stderr: null,
  code: 0,
  cat: [Function: bound ],
  exec: [Function: bound ],
  grep: [Function: bound ],
  head: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  uniq: [Function: bound ] }

当我尝试运行时:cordova插件添加cordova-plugin-whitelist

Error: Path must be a string. Received { [String: 'D:\\PHONE GAP\\PROJECTS\\RENT
CLUB\\PLATFORMS\\ANDROID\\CORDOVA\\VERSION.BAT']
  stdout: 'D:\\PHONE GAP\\PROJECTS\\RENTCLUB\\PLATFORMS\\ANDROID\\CORDOVA\\VERSI
ON.BAT',
  stderr: null,
  code: 0,
  cat: [Function: bound ],
  exec: [Function: bound ],
  grep: [Function: bound ],
  head: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  uniq: [Function: bound ] }

任何想法?
并且谢谢你

1 个答案:

答案 0 :(得分:0)

我建议重新安装节点 here,git here,cordova和ionic的所有内容。

您可以通过命令npm -v检查节点版本,通过git --version

检查git版本

对于Cordova:npm install -g cordova

对于Ionic:npm install -g ionic

创建应用:ionic start appName blank

转到app文件夹:cd appName

添加平台:ionic platform add android

构建项目:ionic build android

我希望它对你有用。