我有一个使用Jhipster创建的项目,该项目托管在AWS中。事情进展顺利,但我不得不格式化我的电脑并重新安装所有东西(相同的操作系统 - Ubuntu 15.10)。然后,我安装了nodejs 5.10.0,npm 3.8.3和Jhipster 3.0。为了安装Jhipster,我按照here描述的步骤,但使用sudo
来安装软件包:
sudo npm install -g yo
sudo npm install -g bower
sudo npm install -g grunt
sudo npm install -g generator-jhipster
(我的项目最初是基于Jhipster 2.23而使用grunt而不是gulp)。
然后,我按照here描述的步骤安装aws生成器(再次使用sudo
):$sudo npm install aws-sdk progress node-uuid
在我的系统中,可以在/usr/local/lib/node_modules
找到全局节点模块,而不是安装在/usr/lib/node_modules
。
但是当我运行命令来安装这些模块时,我收到一条错误消息并删除generator-jhipster
文件夹(!)
$cd /usr/lib/node_modules/generator-jhipster
$sudo npm install aws-sdk progress node-uuid
generator-jhipster@2.23.1 /usr/lib/node_modules/generator-jhipster
├── aws-sdk@2.3.0 extraneous
├── node-uuid@1.4.7 extraneous
└── progress@1.1.8 extraneous
npm ERR! Linux 4.2.0-34-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "aws-sdk" "progress" "node-uuid"
npm ERR! node v5.10.0
npm ERR! npm v3.8.3
npm ERR! path /usr/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-ad396f5f
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-ad396f5f' -> '/usr/lib/node_modules/generator-jhipster'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-ad396f5f' -> '/usr/lib/node_modules/generator-jhipster'
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! Linux 4.2.0-34-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "aws-sdk" "progress" "node-uuid"
npm ERR! node v5.10.0
npm ERR! npm v3.8.3
npm ERR! path npm-debug.log.2689400133
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.2689400133'
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.2689400133'
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! /usr/lib/node_modules/generator-jhipster/npm-debug.log
我记得当我在之前的环境中安装它时,我也遇到了安装aws模块的问题,但我能够通过使用某种技巧使其工作。这次我无法想出任何事情。
我也尝试安装过去相同的jhipster版本(2.23),尝试将权限更改为node_manager文件夹并运行没有sudo
的所有内容,尝试将其安装在我的主文件夹中但没有任何效果。每当我在npm install aws-sdk progress node-uuid
文件夹下运行generator-jhipster
时,就会引发上一个错误并删除该文件夹。
有什么想法吗?
编辑:关注@gaël-marziou的提示,我使用nvm重新安装了节点。我安装了v4.4.2节点,这是一个LTS版本。现在一切都安装在~/.nvm
文件夹下。当我尝试在generator-jhipster
文件夹下安装amy软件包时,我遇到了同样的问题:
~/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster$ npm install aws-sdk progress node-uuid
generator-jhipster@2.23.1 /home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster
├── aws-sdk@2.3.0 extraneous
├── node-uuid@1.4.7 extraneous
└── progress@1.1.8 extraneous
npm ERR! Linux 4.2.0-34-generic
npm ERR! argv "/home/jodevan/.nvm/versions/node/v4.4.2/bin/node" "/home/jodevan/.nvm/versions/node/v4.4.2/bin/npm" "install" "aws-sdk" "progress" "node-uuid"
npm ERR! node v4.4.2
npm ERR! npm v3.8.5
npm ERR! path /home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-b76490c0
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-b76490c0' -> '/home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster'
npm ERR! enoent ENOENT: no such file or directory, rename '/home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster/node_modules/.staging/generator-jhipster-b76490c0' -> '/home/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster'
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! Linux 4.2.0-34-generic
npm ERR! argv "/home/jodevan/.nvm/versions/node/v4.4.2/bin/node" "/home/jodevan/.nvm/versions/node/v4.4.2/bin/npm" "install" "aws-sdk" "progress" "node-uuid"
npm ERR! node v4.4.2
npm ERR! npm v3.8.5
npm ERR! path npm-debug.log.151200600
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.151200600'
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.151200600'
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/jodevan/.nvm/versions/node/v4.4.2/lib/node_modules/generator-jhipster/npm-debug.log
谢谢, Jodevan。
答案 0 :(得分:1)
很少有评论:
更重要:JHipster不支持从2.x升级到3.0的项目升级。
您应该安装使用的相同版本:npm install -g generator-jhipster@2.23.1
答案 1 :(得分:0)
好吧,我最后不得不再次重新安装我的系统,这次一切正常。我已经使用在https://nodejs.org/en/download/package-manager找到的ppa存储库安装了node
v.4.4.4(LTS)(我之前也尝试过这样做)。我还使用http://jhipster.github.io/installation中的说明以及http://jhipster.github.io/aws中列出的相同说明安装了JHipster(2.23)及其依赖项。
现在一切都很完美。去图......