执行 npx create-ol-app失败的解决办法
按照这个教程https://openlayers.org/en/latest/doc/tutorials/bundle.html搭建openlayer application,执行“npx create-ol-app”命令的时候失败了:[root@localhost olapp]# npx create-ol-appnpx: 9 安装成功,用时 3.298 秒> msgpackr-extra
按照这个教程https://openlayers.org/en/latest/doc/tutorials/bundle.html搭建openlayer application,执行“npx create-ol-app”命令的时候失败了:
[root@localhost olapp]# npx create-ol-app
npx: 9 安装成功,用时 3.298 秒
> msgpackr-extract@1.0.13 install /root/olapp/node_modules/msgpackr-extract
> node-gyp-build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/olapp/node_modules/msgpackr-extract/build'
gyp ERR! System Linux 3.10.0-1062.el7.x86_64
gyp ERR! command "/root/nodes/node-v14.17.5-linux-x64/bin/node" "/root/nodes/node-v14.17.5-linux-x64/lib/node_modules/npm/node_modules/nld"
gyp ERR! cwd /root/olapp/node_modules/msgpackr-extract
gyp ERR! node -v v14.17.5
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
> lmdb-store@1.6.5 install /root/olapp/node_modules/lmdb-store
> node-gyp-build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/olapp/node_modules/lmdb-store/build'
gyp ERR! System Linux 3.10.0-1062.el7.x86_64
gyp ERR! command "/root/nodes/node-v14.17.5-linux-x64/bin/node" "/root/nodes/node-v14.17.5-linux-x64/lib/node_modules/npm/node_modules/nld"
gyp ERR! cwd /root/olapp/node_modules/lmdb-store
gyp ERR! node -v v14.17.5
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lmdb-store@1.6.5 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lmdb-store@1.6.5 install 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! /root/.npm/_logs/2021-08-12T10_22_59_150Z-debug.log
npm install failed
问题:
nodejs是以root身份安装的。
解决办法:
新创建用户,以该用户身份安装nodejs,再做这个教程就好了。
make: 离开目录“/home/estuser/olapp/node_modules/lmdb-store/build”
> @parcel/watcher@2.0.0-alpha.10 install /home/estuser/olapp/node_modules/@parcel/watcher
> node-gyp-build
> core-js@3.16.0 postinstall /home/estuser/olapp/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js
> https://patreon.com/zloirock
> https://paypal.me/zloirock
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> ejs@2.7.4 postinstall /home/estuser/olapp/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
added 820 packages in 64.014s
简单记录一下,方便碰到这个问题的人。
更多推荐
所有评论(0)