Linux NPM 无法安装 appjs。错误:找不到模块“graceful-fs”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10776405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:31:52  来源:igfitidea点击:

NPM can't install appjs. Error: Cannot find module 'graceful-fs'

linuxnode.jsnpm

提问by Ruby

I installed node.js and npm already, but when I try to install appjs I get this error:

我已经安装了 node.js 和 npm,但是当我尝试安装 appjs 时出现此错误:

zephlon@zephlon-T5254:~$ npm install appjs

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module 'graceful-fs'
    at Function._resolveFilename (module.js:334:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:357:17)
    at require (module.js:368:17)
    at Object.<anonymous> (/usr/share/npm/lib/utils/ini.js:32:10)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Module.require (module.js:357:17)

I get similar errors on any attempt to install graceful-fs.

任何尝试安装graceful-fs.

I am using Ubuntu 12.04 LTS.

我正在使用 Ubuntu 12.04 LTS。

P.S.: Here's the link to the appjs website: http://appjs.org/

PS:这是appjs网站的链接:http://appjs.org/

回答by Ajax

I had this problem when trying to install anything with npm on a Ubuntu LTS12.04 vps, and I solved it with

我在 Ubuntu LTS12.04 vps 上尝试使用 npm 安装任何东西时遇到了这个问题,我用

sudo apt-get remove npm
sudo apt-get install npm

You may also want to run npm install __ inside of /usr/lib/nodejs

您可能还想在 /usr/lib/nodejs 中运行 npm install __

回答by Rajender Saini

use the following script to solve this

使用以下脚本来解决这个问题

git clone git://github.com/isaacs/npm.git
cd npm/script
chmod +x bootstrap
sudo ./bootstrap

回答by webwurst

With the node.js PPAfrom Chris Lea, npmis integrated in the nodejspackage since version 0.10. Works with 12.04 LTS.

来自 Chris Lea的node.js PPA0.10 版开始npm集成在nodejs包中。适用于 12.04 LTS。

回答by quetzaluz

I also had the graceful-fs problem. After seeing this message when trying to update npm:

我也有优雅的 fs 问题。在尝试更新 npm 时看到此消息后:

Error: npm doesn't work with node v0.10.0
Required: [email protected] || 0.7 || 0.8

I used the n module to switch to 0.8.22stable release of node. I was able to install graceful-fs, request, and other modules after that. Probably not the best solution, but none of the other solutions here worked for me.

我使用 n 模块切换到node 的 0.8.22稳定版本。在那之后,我能够安装优雅的 fs、请求和其他模块。可能不是最好的解决方案,但这里的其他解决方案都不适合我。