node.js - 安装 screepsmod-mongo 并运行 npx screeps start 后权限被拒绝

标签 node.js mongodb npm redis screeps

我成功安装了 screepmod-mongo。但是在执行npx screeps start时出现错误,如下:

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, stat '/root/.npm/_npx/4679/lib/node_modules/screeps/node_modules/isolated-vm/.node-gyp/8.16.0'
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "4"
gyp ERR! cwd /root/.npm/_npx/4679/lib/node_modules/screeps/node_modules/isolated-vm
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! isolated-vm@1.7.10 install: `node-gyp rebuild --release -j 4`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the isolated-vm@1.7.10 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/2019-07-30T01_45_59_317Z-debug.log
Install for screeps@latest failed with code 1

以下是我使用的版本列表。

  • Node 8.16.0
  • npm 6.4.1
  • 小程序 3.4.3
  • screepsmod-mongo 2.5.5
  • mongodb 4.0.10
  • redis 5.0.5

以下是安装screepsmod-mongo时的输出。

Screeps mod "screepsmod-mongo" has been successfully installed
+ screepsmod-mongo@2.5.5
added 15 packages from 10 contributors, removed 541 packages, updated 1 package and audited 183 packages in 85.481s
found 3 vulnerabilities (1 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details

我的mongodbredis安装正确,地址是mongodb://screeps-mongoscreeps-redis。我在.screepsrc中做了如下配置:

[mongo]
host = mongodb://screeps-mongo

[redis]
host = screeps-redis

以下内容在 mods.json 中:

"mods": [
  "node_modules/screepsmod-mongo/index.js"
]

我该如何解决这个问题?

最佳答案

我解决了,好像是npm引起的。切换到yarn安装不会出现这个问题

关于node.js - 安装 screepsmod-mongo 并运行 npx screeps start 后权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57263663/

相关文章:

node.js - bundledDependencies 相对于 npm 中的普通依赖项的优势

node.js - 为什么运行app.js会显示错误: Cannot find module 'discord.js'

node.js - 如何在 Sinon.JS/Node 中调用 fakeServer

node.js - 为什么我必须使用 "npm start x"启动某些脚本,而其他脚本仅使用 "npm x"启动?

javascript - 无法获取/帖子/任何内容。看起来 req.params 不起作用

javascript - 使用来自 SSH2 的 SFTP 对象

node.js - 为什么我必须以管理员身份调用 npm link?

javascript - 如何在mongodb中获取更新查询WriteResult

mongodb - 我可以/应该使用面向文档的数据库作为用户数据库吗?

mongodb - 中断获取从 MongoDB 池中检索项目的许可