ENOENT错误-安装AWS-CDK节点模块

时间:2019-06-24 20:44:54

标签: node.js amazon-web-services npm aws-certificate-manager aws-cdk

运行命令后:

       sudo npm i -g aws-cdk

给出错误:

npm ERR! Linux 4.4.0-151-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "i" "-g" "aws-cdk"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/semver-096e2ca7
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/semver-096e2ca7' -> '/usr/local/lib/node_modules/aws-cdk/node_modules/@aws-cdk/cx-api/node_modules/semver'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/semver-096e2ca7' -> '/usr/local/lib/node_modules/aws-cdk/node_modules/@aws-cdk/cx-api/node_modules/semver'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/user/npm-debug.log
npm ERR! code 1

正在安装aws-cdk模块以使用AWS ACM服务创建私有CA和证书

{ npm: '3.5.2',
  ares: '1.10.1-DEV',
  http_parser: '2.5.0',
  icu: '55.1',
  modules: '46',
  node: '4.2.6',
  openssl: '1.0.2g',
  uv: '1.8.0',
  v8: '4.5.103.35',
  zlib: '1.2.8' }

如何解决此错误?能够安装其他npm模块(如打字稿)

2 个答案:

答案 0 :(得分:1)

我今天才遇到这个问题。我认为这是因为Ubuntujs的aptjs apt安装不起作用。我卸载了sudo apt remove nodejs,然后从https://nodejs.org/en/download/手动安装了文件,该文件基本上只是从下载到/ usr / local /的所有子目录的sudo cp -r。在那之后工作了。

答案 1 :(得分:1)

问题在于先前安装的nodejs。在安装CDK之前,请先卸载并重新安装Node.js。那应该可以解决问题