javascript - 我无法安装特定的节点模块 [ejs]
问题描述
要学习 node.js,我想建立一个简单的网站。为此,我想使用 ejs。但是 ejs 的安装总是失败。我在多台机器上用不同的方法试过这个。在 npm 的设置中使用 Webstorms 内置方法并在网络服务器上使用 Plesk 我收到以下错误:
npm WARN lifecycle npm is using /opt/plesk/node/12/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: node: command not found
npm WARN bootstrap@4.4.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.4.1 requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN project@1.0.0 No description
npm WARN project@1.0.0 No repository field.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! ejs@3.1.2 postinstall: `node --harmony ./postinstall.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the ejs@3.1.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Webstorm 在我的本地机器上给了我一个非常相似的错误。我尝试过的任何其他 npm 包都可以正常工作。我安装了 express、bootstrap、jquery 等。问题似乎只出在 ejs 上。
我的 package.json 看起来像:
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^4.4.1",
"express": "^4.17.1",
"morgan": "^1.10.0"
}
}
有什么建议么?一个问题是我只能在我的网络服务器上提供 Plesk 提供的功能,因为我无权以普通用户身份运行 node 或 npm。
解决方案
npm WARN lifecycle npm is using /opt/plesk/node/12/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: node: command not found
此错误描述了使用 plesk 时的解决方案,您正在使用哪个?另见
推荐阅读
- security - NGINX SSL 仅针对特定域有错误 ERR_SSL_VERSION_OR_CIPHER_MISMATCH
- awk - 在 sed 中的第一个匹配后删除 n 行
- c# - 多个客户端和一个服务器 Blazor 资产冲突
- python - 无法在 Pycharm 中使用来自 pywin32 的 win32gui 模块
- nginx - nginx将某个站点从http重定向到https不起作用
- javascript - 我有 html 网站文件夹。我必须在 iframe 中动态加载该网站,保持 src 属性为空
- nuget - NuGet PackageManager.InstallPackageAsync() 抛出 NullReferenceException
- azure-ad-b2c - 通过 Azure AD B2C 将第三方 IDP 的访问令牌传递给应用程序
- isabelle - 在归纳规则生成的文本中添加注释
- python - Django 3.X 管理员在新导航栏中显示所有模型