我尝试运行以下Angular项目:
{
LoadingIndicatorView.show(loadingView!)
LoadingIndicatorView.show("Please Wait...")
let imageData = UIImageJPEGRepresentation(image, 0.5)!
let length: Float = Float(imageData.count)
let fileSizeString = "\(length)"
if let data = UIImagePNGRepresentation(image) {
let filename = getDocumentsDirectory().appendingPathComponent("copy.png")
try? data.write(to: filename)
// print(filename)
}
let keys = ["size" ,"name","modifiedOn","file"]
let values = [fileSizeString,"photo.jpg","2016-12-12",imageData] as [Any]
let dictionary = NSMutableDictionary(objects: values, forKeys: keys as [NSCopying])
let SubscriptionDict: [String : AnyObject] = [
"type" :"IMAGE" as AnyObject,
"data" :dictionary as AnyObject
]
let Arr1 = NSMutableArray()
Arr1.add(SubscriptionDict)
let chatDict: [String : AnyObject] = [
"text": "" as AnyObject,
"chatId":chatInfoDict?["_id"] as! String as AnyObject ,
"identifier":"147853531XXXX" as AnyObject,
"sessionId":"14785348XXXXX" as AnyObject,
"attachments" :Arr1 as AnyObject
]
FAWebSocketClient.sharedClient.doEvent(eventName: "MESSAGE_CREATE", tmp: chatDict as AnyObject!);
}
克隆它,将其CD到根文件夹,然后执行https://github.com/MangeshPersonal/Observabledemo.git
。出现错误:
ng serve
如何解决此错误并使其起作用?该Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
at WorkspaceLoader._getProjectWorkspaceFilePath (/usr/local/lib/node_modules/@angular/cli/models/workspace-loader.js:37:19)
at WorkspaceLoader.loadWorkspace (/usr/local/lib/node_modules/@angular/cli/models/workspace-loader.js:24:21)
at ServeCommand._loadWorkspaceAndArchitect (/usr/local/lib/node_modules/@angular/cli/models/architect-command.js:180:32)
at ServeCommand.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/architect-command.js:47:25)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/@angular/cli/models/architect-command.js:7:71
at new Promise (<anonymous>)
at __awaiter (/usr/local/lib/node_modules/@angular/cli/models/architect-command.js:3:12)
at ServeCommand.initialize (/usr/local/lib/node_modules/@angular/cli/models/architect-command.js:46:16)
at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/command-runner.js:87:23)
文件应通过什么程序创建?
如何将这个较旧的项目迁移到angular的新版本?
我正在使用Angular CLI:6.0.8 节点:10.6.0。
谢谢。
答案 0 :(得分:1)
可能是因为您的全局@ angular / cli,项目@angular/cli
或@angular/compiler-cli
的版本不匹配。
您可以运行以下命令来验证
ng -v
如果它们不匹配,例如:
"@angular/cli": "6.0.0-rc.3",
"@angular/compiler-cli": "^5.2.0",
然后,您需要更新或降级以匹配这两者。