cesiumjs GIS引擎源码编译并运行-2021年3月18日最新版【1.68~1.79.1版本亲测成功】
前言
本篇最初是在2020年的【macOS Big Sur + Cesium 1.76版本】下编译成功,后在【macOS Catalina+cesium 1.79.1版本】编译过程中,出现编译的错误和诸多不畅快,经过多方尝试终于解决了,于2021年3月18日重新整理,将遇到的问题和处理方法贴在本文末尾,供遇到相同问题的小伙伴参考,少走弯路。如果是遇到问题的,直接跳到文章最后部分“故障处理”章节寻求答案,亦可与我联系:QQ:335940945(请注明来意,否则不通过,谢谢合作)
cesium源码编译并运行
真传一句话:务必下载正确的源码包,否则搞死不出来(小神若不是历经九九八十一难被坑,也不用费神写此鸡精,本文开头即是妙意所在,好好体悟)。
注意️:
1.必须是下载源码包,不是官方发布包,发布包已经被阉割,出不来“Development”;
2.不同环境可能导致不同的提示或者报错,如果实在找不出问题所在,请查是否系统和nodejs版本及配套编译、打包工具环境是否存在问题。本文测试实验环境为CentOS 8 + Nodejs最新版本。实在搞不定的可QQ联系博主,免费分享经验:335940945
这里附上正确下载源码包的姿势
第一步:进入cesium官网https://cesium.com/cesiumjs/,找到“Platform”下的“CesiumJS”;
https://cesium.com/downloads/cesiumjs/
第二步:用你的火眼金睛定位瞄准“source”,不要点绿绿的大图标,不然你就真的被绿了,点开“Previous releases”,里面藏了所有的版本源代码和编译版本,对应版本后面的“source”才是我们心仪的女神小仙女。
欧了,下载“Sounce”包以后就可以开始按照下面的教程安装编译了,接着开发了。
源码经过编译运行后会比发行版多一个Development分组。如图:
编译后版本:
官方版本:
cesium源码编译打包需要gulp,如果电脑上没有安装gulp,那么需要进行安装。
安装gulp:
前提下是电脑上装有node环境和npm环境,此处不再赘述。
解压cesium源码压缩包,在其所在路径,按下shift并鼠标右键选择“在此处打开命令窗口”
1.设置淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
不安装淘宝镜像则需要FQ获取下一步的资源。
2.安装gulp:
npm install gulp -g
全局安装gulp
3.对cesium源码安装npm依赖:
npm install
此时cesium根目录中多出node_modules文件夹
4.build打包:
npm run build
在Source文件夹下生成了Cesium.js,还在Specs文件夹内生成了SpecList.js和在Build文件夹下生成了minifyShaders.state文件
Source文件夹下的Cesium.js是把Cesium源码中一千两百多个js文件做了一下引用,相当于一个索引。
打包之后cesium根目录下多出了Build文件夹。
5.运行cesium:
npm start
cesium设置的默认端口是8080,用浏览器打开,(此方法只适合于本机访问,至于在局域网中访问,需要使用另外的命令进行端口开放,本博主其他文章将做说明,如需要请关注)
localhost:8080
就可以查看了:
点击Sandcastle打开cesium官方案例:
故障处理
【含新版本1.79.1安装部署步骤解析】
1.新版本遇到的问题
直接贴上本地源码编译遇到的问题和尝试处理过程先,高手直接自己抠出武功秘籍
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -g
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T00_50_14_532Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install yarm -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T00_52_04_209Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install yarm -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T00_52_22_569Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ yarm install
-bash: yarm: command not found
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ yarm install
-bash: yarm: command not found
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install yarm -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T00_52_41_181Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install
npm WARN rollup-plugin-uglify@6.0.4 requires a peer of rollup@>=0.66.0 <2 but none is installed. You must install peer dependencies yourself.
audited 948 packages in 4.829s
55 packages are looking for funding
run `npm fund` for details
found 1 high severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm run build
> cesium@1.79.1 build /Applications/MAMP/htdocs/gaea-1.79.1.2
> gulp build
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'gulp-cli'
Require stack:
- /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp:3:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cesium@1.79.1 build: `gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cesium@1.79.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! /Users/tony/.npm/_logs/2021-03-18T03_15_38_307Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ yum install gulp -g
-bash: yum: command not found
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ brew install gulp -g
Updating Homebrew...
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': Failed to connect to github.com port 443: Operation timed out
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': Operation timed out after 300018 milliseconds with 0 out of 0 bytes received
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -g
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T03_26_13_219Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install -g cnpm --registry=https://registry.npm.taobao.org
-bash: npm install -g cnpm --registry=https://registry.npm.taobao.org: No such file or directory
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -g
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T03_28_17_293Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ su root
Password:
su: Sorry
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ su root
Password:
su: Sorry
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ su root
Password:
su: Sorry
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ su root
Password:
su: Sorry
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install vue-cli -g
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T03_53_55_529Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
[恢复于2021年3月18日 下午1:18:24]
Last login: Thu Mar 18 13:18:11 on console
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp-cli -g
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T06_33_16_765Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ ls
Apps README.md index.cjs
Build Source index.html
CHANGES.md Specs index.release.html
CODE_OF_CONDUCT.md ThirdParty launches
CONTRIBUTING.md Tools node_modules
CONTRIBUTORS.md favicon.ico package.json
Documentation greenkeeper.json server.cjs
LICENSE.md gulpfile.cjs web.config
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ chmod 777 node_modules/
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp-cli -g
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T06_34_14_663Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ chmod 777 /usr/local/lib/node_modules
chmod: Unable to change file mode on /usr/local/lib/node_modules: Operation not permitted
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ sudo chmod 777 /usr/local/lib/node_modules
Password:
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp-cli -g
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
+ gulp-cli@2.3.0
added 246 packages from 165 contributors in 29.501s
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -D
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN rollup-plugin-uglify@6.0.4 requires a peer of rollup@>=0.66.0 <2 but none is installed. You must install peer dependencies yourself.
npm ERR! code EEXIST
npm ERR! path /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp
npm ERR! Refusing to delete /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp: is outside /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/gulp and not a link
npm ERR! File exists: /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T06_36_30_958Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ chmod 777 /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -D
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN rollup-plugin-uglify@6.0.4 requires a peer of rollup@>=0.66.0 <2 but none is installed. You must install peer dependencies yourself.
npm ERR! code EEXIST
npm ERR! path /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp
npm ERR! Refusing to delete /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp: is outside /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/gulp and not a link
npm ERR! File exists: /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/gulp
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tony/.npm/_logs/2021-03-18T06_38_02_518Z-debug.log
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -D
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> fsevents@1.2.13 install /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/fsevents
> node install.js
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/fsevents
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
+ gulp@4.0.2
added 326 packages from 227 contributors and audited 326 packages in 49.599s
7 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ /usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
-bash: /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: No such file or directory
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ /usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild
-bash: /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: No such file or directory
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ gulp rebuild /usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
Error: Cannot find module 'request'
Require stack:
- /Applications/MAMP/htdocs/gaea-1.79.1.2/gulpfile.cjs
- /usr/local/lib/node_modules/gulp-cli/lib/shared/require-or-import.js
- /usr/local/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /usr/local/lib/node_modules/gulp-cli/index.js
- /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Applications/MAMP/htdocs/gaea-1.79.1.2/gulpfile.cjs:11:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Applications/MAMP/htdocs/gaea-1.79.1.2/gulpfile.cjs',
'/usr/local/lib/node_modules/gulp-cli/lib/shared/require-or-import.js',
'/usr/local/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js',
'/usr/local/lib/node_modules/gulp-cli/index.js',
'/usr/local/lib/node_modules/gulp-cli/bin/gulp.js'
]
}
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npx -p touch nodetouch gulpfile.js
npx: 3 安装成功,用时 3.489 秒
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp-cli -g
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
+ gulp-cli@2.3.0
updated 1 package in 28.055s
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install gulp -D
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
+ gulp@4.0.2
updated 1 package and audited 326 packages in 35.98s
found 0 vulnerabilities
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npx -p touch nodetouch gulpfile.js
npx: 3 安装成功,用时 2.182 秒
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ gulp --help
Usage: gulp [options] tasks
选项:
--help, -h Show this help. [布尔]
--version, -v Print the global and local gulp versions. [布尔]
--require Will require a module before running the gulpfile.
This is useful for transpilers but also has other
applications. [字符串]
--gulpfile, -f Manually set path of gulpfile. Useful if you have
multiple gulpfiles. This will set the CWD to the
gulpfile directory as well. [字符串]
--cwd Manually set the CWD. The search for the gulpfile, as
well as the relativity of all requires will be from
here. [字符串]
--verify Will verify plugins referenced in project's
package.json against the plugins blacklist.
--tasks, -T Print the task dependency tree for the loaded
gulpfile. [布尔]
--tasks-simple Print a plaintext list of tasks for the loaded
gulpfile. [布尔]
--tasks-json Print the task dependency tree, in JSON format, for
the loaded gulpfile.
--tasks-depth, --depth Specify the depth of the task dependency tree. [数字]
--compact-tasks Reduce the output of task dependency tree by printing
only top tasks and their child tasks. [布尔]
--sort-tasks Will sort top tasks of task dependency tree. [布尔]
--color Will force gulp and gulp plugins to display colors,
even when no color support is detected. [布尔]
--no-color Will force gulp and gulp plugins to not display
colors, even when color support is detected. [布尔]
--silent, -S Suppress all gulp logging. [布尔]
--continue Continue execution of tasks upon failure. [布尔]
--series Run tasks given on the CLI in series (the default is
parallel). [布尔]
--log-level, -L Set the loglevel. -L for least verbose and -LLLL for
most verbose. -LLL is default. [计数]
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm install
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
> husky@4.3.8 install /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/husky
> node husky install
husky > Setting up git hooks
git rev-parse command failed. Got fatal: not a git repository (or any of the parent directories): .git
husky > Failed to install
> husky@4.3.8 postinstall /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/husky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
npm WARN rollup-plugin-uglify@6.0.4 requires a peer of rollup@>=0.66.0 <2 but none is installed. You must install peer dependencies yourself.
added 555 packages from 968 contributors and audited 885 packages in 102.272s
56 packages are looking for funding
run `npm fund` for details
found 1 high severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm run build
> cesium@1.79.1 build /Applications/MAMP/htdocs/gaea-1.79.1.2
> gulp build
[14:50:02] Using gulpfile /Applications/MAMP/htdocs/gaea-1.79.1.2/gulpfile.cjs
[14:50:02] Starting 'build'...
[14:50:07] Finished 'build' after 4.73 s
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm run generateDocumentation
> cesium@1.79.1 generateDocumentation /Applications/MAMP/htdocs/gaea-1.79.1.2
> gulp generateDocumentation
[14:50:26] Using gulpfile /Applications/MAMP/htdocs/gaea-1.79.1.2/gulpfile.cjs
[14:50:26] Starting 'generateDocumentation'...
[14:50:59] Finished 'generateDocumentation' after 33 s
TonyBruceWudeMacBook-Pro:gaea-1.79.1.2 tony$ npm start
> cesium@1.79.1 start /Applications/MAMP/htdocs/gaea-1.79.1.2
> node server.cjs
Cesium development server running locally. Connect to http://localhost:8080/
拆分如下:
(1)、问题描述:本意是想按照上文的步骤
1.设置淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
不安装淘宝镜像则需要FQ获取下一步的资源。
2.安装gulp:
npm install gulp -g
全局安装gulp
3.对cesium源码安装npm依赖:
npm install
此时cesium根目录中多出node_modules文件夹
4.build打包:
npm run build
在Source文件夹下生成了Cesium.js,还在Specs文件夹内生成了SpecList.js和在Build文件夹下生成了minifyShaders.state文件
Source文件夹下的Cesium.js是把Cesium源码中一千两百多个js文件做了一下引用,相当于一个索引。
打包之后cesium根目录下多出了Build文件夹。
5.运行cesium:
npm start
但很明显在第2步骤就出现了问题,安装gulp各种报错,雀神怪鸟
问题研究:仔细研究报错信息,发现有大部分的问题是权限的问题,运行报错中也体现出解决方向。
处理思路:第一步给足权限;第二步到gulp官网下载最新的gulp安装包安装,按照官网提供的正确完整的步骤先把gulp安装完整,测试通过,然后再重复如上步骤。
解决方案:
先瞟了一眼官网gulp的安装步骤
npm install gulp-cli -g
npm install gulp -D
npx -p touch nodetouch gulpfile.js
gulp --help
再次确认了单独搞定gulp必经之路,然后逐步解锁各种高难度姿势。
(1)、给出错提示的文件及目录加上最高的读写权限
执行命令:
chmod 777 /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules/.bin/
npm install gulp-cli -g
紧接着就执行这条命令,又发现了下面的报错,还是被拒绝,原因是文件已存在。
干脆跑到项目根目录
/Applications/MAMP/htdocs/gaea-1.79.1.2/
下面把整个"node_modules"彻底删除,因为之前运行“npm install”就有产生了,现在gulp没有权限搞不定她。
命令删除的话:
rm -rf /Applications/MAMP/htdocs/gaea-1.79.1.2/node_modules
用"ls"命令在项目目录下确认一下“node_modules”已经彻底被消灭了,没有影子了,然后重新运行命令:
npm install gulp-cli -g
现在能正常往下走了,虽然有WARN黄色警告,但已经没有红色的“ERR!”报错了,走完以后出现类似提示说明gulp-cli已经安装成功:
现在接着分别依次运行如下三条命令:
npm install gulp -D
npx -p touch nodetouch gulpfile.js
gulp --help
最后一条是帮助提示,不熟悉的可以多看看。
不报错正常走完就OK了,然后依照上面的步骤依次运行以下5步骤,其中第1、2步骤因为我们已经执行过,也可以跳过,怕出错可以依次运行直到最后:
1.设置淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
不安装淘宝镜像则需要FQ获取下一步的资源。
2.安装gulp:
npm install gulp -g
全局安装gulp
3.对cesium源码安装npm依赖:
npm install
此时cesium根目录中多出node_modules文件夹
4.用gulp组织生成文档
npm run generateDocumentation
这里实际上是调用gulp来生成Documentation里面的html格式的文档和函数说明等内容,最好一次性走完了,不然
5.build打包:
npm run build
在Source文件夹下生成了Cesium.js,还在Specs文件夹内生成了SpecList.js和在Build文件夹下生成了minifyShaders.state文件
Source文件夹下的Cesium.js是把Cesium源码中一千两百多个js文件做了一下引用,相当于一个索引。
打包之后cesium根目录下多出了Build文件夹。
6.运行npm服务器启动cesium:
就可以在浏览器里面用 “localhost:8080”访问到根目录了,我用的MAMP来做本地的服务器环境,根目录默认指向到 " /Applications/MAMP/htdocs/"目录之下,因为有很多个项目,所以在其后面要加上项目的目录:例如: 绝对目录在:“/Applications/MAMP/htdocs/gaea-1.79.1.2”,访问地址就是:http://localhost:8080
这里的gaea相当于你们默认的cesium,cesium 1.79.1版本对应的就是
http://localhost:8080
npm start
看到这个久违的界面,希望就续上了
看到正常的样例和"Development"选项卡下的案例都正常,开发前第一步准备工作就做到位了,可以开始发挥了
一点小小的说明:1.79.1 版本对Bing地图的支持好像是萎了,自己切换下地图,就能正常显示了。
有好的解决办法和新的发现,欢迎跟帖探讨。
cesiumjs GIS引擎源码编译并运行-2021年3月18日最新版【1.68~1.79.1版本亲测成功】的更多相关文章
- android 源码编译及其运行模拟器相关问题记录
最近一直在看android源码相关的文档,包括编译源码,还有framework层的代码,本人很懒,一直没有写博客,今天想自己在编译一下源码,并且运行在模拟器中. 源码的版本不同,需要的jdk可能也有所 ...
- BDB c++例子,从源码编译到运行
第一步先下载源码,解压后 ./dist/configure --enable-cxx编译,然后make, make install --enable-cxx To build the Berkeley ...
- spark源码编译,运行example遇到:NoClassDefFoundError: org/spark_project/guava/cache/CacheLoader
基本环境: win10+idea Scala2.11.8 maven3.5.3 spark2.1.0 问题: 在window10下编译spark2.1.0源码,在idea下运行example,遇到问题 ...
- C/C++ Capstone 引擎源码编译
Capstone 是一个轻量级的多平台.多架构的反汇编框架.Capstone 旨在成为安全社区中二进制分析和反汇编的终极反汇编引擎.Capstone的编译非常简单只需要一步即可轻松得到对应的Lib库文 ...
- zxing源码编译与运行
编译的jar文件下载地址:http://files.cnblogs.com/rainboy2010/zxing.zip zxing是一个开源的解析条形码/二维码的类库,广泛应用于Android 各大A ...
- 使用源码编译安装PHP7
使用源码编译安装PHP7 2015年6月11日,PHP官网发布消息,正式公开发布PHP7第一版的alpha版本. PHP7特性: PHP 7.0.0 Alpha 1使用新版的ZendEngine引擎, ...
- 《Flink 源码解析》—— 源码编译运行
更新一篇知识星球里面的源码分析文章,去年写的,周末自己录了个视频,大家看下效果好吗?如果好的话,后面补录发在知识星球里面的其他源码解析文章. 前言 之前自己本地 clone 了 Flink 的源码,编 ...
- Flink 源码解析 —— 源码编译运行
更新一篇知识星球里面的源码分析文章,去年写的,周末自己录了个视频,大家看下效果好吗?如果好的话,后面补录发在知识星球里面的其他源码解析文章. 前言 之前自己本地 clone 了 Flink 的源码,编 ...
- 编译 Unity 4.3.1 引擎源码
引言 Unity 官方从 Unity 2017.1 版本开始,开源了引擎和编辑器的C#源码(源码地址:UnityCsReference),但核心的 C/C++ 部分源码并未开源. 编译环境 网上主要的 ...
- 1.EOS源码编译运行
目前网络上都是针对老版EOS2.0源码编译的文章,我在mac上参考这些文章编译,最后发现根本就不对,最新版本只需一条命令(./eosio_build.sh,依赖库会自动安装的)即可.我根据这些文章手动 ...
随机推荐
- 虚拟机安装Mac操作系统
参考博客https://www.bilibili.com/read/cv25662180/?spm_id_from=333.1007.0.0
- android 混淆规则作用,Android代码混淆详解
一.混淆的意义 混淆代码并不是让代码无法被反编译,而是将代码中的类.方法.变量等信息进行重命名,把它们改成一些毫无意义的名字,同时也可以移除未被使用的类.方法.变量等. 所以直观的看,通过混淆可以提高 ...
- 14 CodeTON Round 5 (Div. 1 + Div. 2, Rated, Prizes!)C. Tenzing and Balls(dp+前缀最大值优化)
思路: dp还是挺明显的,思路可以参考最长上升子序列 有点dp的感觉 \(f[i]\)表示考虑前\(i\)个数,的最大值 当前数有两种删或不删 不删:\(f[i]=f[i-1]\); 删:\(f[i] ...
- nginx流量复制与放大
1. 需求 功能需求 在不影响真实业务前提下,支持: 流量复制,用于线故障分析.系统迁移评估等 流量放大,通过多倍复制,实现放大流量,用于性能压测 配置需求 支持或禁止post请求复制 记录镜像请求的 ...
- Java求解汉诺塔
汉诺塔 汉诺塔(Tower of Hanoi),又称河内塔,是一个源于印度古老传说的益智玩具.大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘.大梵天命令婆罗 ...
- Educational Codeforces Round 141:B. Matrix of Differences
一.来源:Problem - B - Codeforces 二.题面 三.思路 我们先从一维思考如何构造尽可能多的数值差.以n=2为例,此时有1,2,3,4数,其中构成差值为3的方案有一个1,4,构成 ...
- leetcode数据库sql之Rising Temperature
leetcode原文引用: Given a Weather table, write a SQL query to find all dates' Ids with higher temperatur ...
- 移远EC20 4G模块Linux驱动移植和测试
PS:要转载请注明出处,本人版权所有. PS: 这个只是基于<我自己>的理解, 如果和你的原则及想法相冲突,请谅解,勿喷. 前置说明 本文作为本人csdn blog的主站的备份.(Bl ...
- tomcat无法启动的解决方法
一:双击startup.bat但闪退 我们可以用记事本打开startup.bat 在末尾添加一个pause 这样它就会新建一个窗口停在错误的地方 二:根据报错信息改正 这一步如果有乱码可以进入tomc ...
- uni之this作用域
目录介绍 01.先看一个案例 02.看一下解决方案 01.先看一个案例 代码如下所示 发现了点击按钮1可以更新title内容,但是点击按钮2却无法更新title内容.这个究竟是为什么呢? <te ...