Javascript 我无法安装特定的节点模块[ejs]
为了学习node.js,我想建立一个简单的网站。为此,我想使用ejs。然而,ejs的安装总是失败。我用不同的方法在多台机器上进行了尝试。 在npm设置中使用WebStorm内置方法,并在Web服务器上使用Plesk,我得到以下错误:Javascript 我无法安装特定的节点模块[ejs],javascript,node.js,ejs,Javascript,Node.js,Ejs,为了学习node.js,我想建立一个简单的网站。为此,我想使用ejs。然而,ejs的安装总是失败。我用不同的方法在多台机器上进行了尝试。 在npm设置中使用WebStorm内置方法,并在Web服务器上使用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-prepe
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上
My 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"
}
}
有什么建议吗?还有一个问题是,由于我没有作为普通用户运行node或npm的权限,所以我只能在我的Web服务器上使用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
此错误描述了使用plesk时的解决方案,您正在使用?也看到
删除node\u模块,然后安装
npm
我想这可能会对您有所帮助。遗憾的是,这对我没有帮助。我有同样的错误显示您的包依赖项。我添加了package.json,如果这是您的意思的话。我建议将其用作节点包管理器。根据我的经验,使用它要简单得多。此外,如果您要使用npm,请确保已安装最新版本。有时候这是个问题。还有一个使依赖项安装更简单的方法(尽管我没有使用插件,所以我无法验证该语句),就是这样!非常感谢。这有助于解决我的本地windows机器(非Plesk)上的问题。只需在项目的根文件夹中创建一个.npmrc文件,并向其中添加“scripts prepend node path=true”。