执行 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-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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值