ionic报错: Failed to load resource
隔了一天,才发现是代码写错了
出错的原因是在ts 文件中使用这样的定义
data: [] = ['高新区', '经开区', '其他园区'];
错误在于这个定义的类型,不能是 [],修改成 any就没有问题了
data: any = ['高新区', '经开区', '其他园区'];
醉了
不知道怎么搞的,突然ionic报错: Failed to load resource 导致项目启动不起来
该问题的最终解决办法是,把git项目重新克隆了一遍。所以今天并没有找到错误的原因
记录解决过程
发现这些丢失的文件都是在build目录下的
所以执行build命令,但是报错如下:
这个错误搞不懂,没搜到解决办法,于是想先删除了node_modules,在安装
重新运行npm install命令 安装
结果报错:从github下载超时
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node":
connect ETIMEDOUT 54.231.49.194:443
这里尝试了很多解决办法,终于可以下载了
但是再返回执行 build命令,还是报错,绝望了
[17:05:23] ionic-app-script task: "build"
[17:05:23] Error: Debug Failure.
Error: Debug Failure.
at typeToString (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:28777:22)
at reportRelationError (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:34714:34)
at isRelatedTo (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:34860:21)
at checkTypeRelatedTo (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:34697:26)
at checkTypeAssignableTo (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:34398:20)
at checkVariableLikeDeclaration (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:44884:21)
at checkPropertyDeclaration (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:43383:13)
at checkSourceElement (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:46700:28)
at Object.forEach (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:1506:30)
at checkClassDeclaration (E:\Workspaces\WebStormProject\guizhouApp\node_modules\typescript\lib\typescript.js:45765:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! guizhouApp@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the guizhouApp@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! E:\jiashubing\npm_cache\_logs\2017-12-28T09_05_23_905Z-debug.log
把每一件简单的事情做好,就是不简单;把每一件平凡的事情做好,就是不平凡!相信自己,创造奇迹~~