I wanted to upgrade a generator, so I hit npm update -g generator-jhipster, I have node installed via nvm using v6.9.2.
Even after removing and reinstalling nvm, npm, yo, I still see the same generators!?
~/Documents/workspace/jhipster$ which yo
/Users/jordanbaucke/.nvm/versions/node/v6.9.2/bin/yo
~/Documents/workspace/jhipster$ which npm
/Users/jordanbaucke/.nvm/versions/node/v6.9.2/bin/npm
~/Documents/workspace/jhipster$ which node
/Users/jordanbaucke/.nvm/versions/node/v6.9.2/bin/node
~/Documents/workspace/jhipster$ yo --generators
All looks good!
~/Documents/workspace/jhipster$ yo --generators
Available Generators:
jhipster
cloudfoundry
entity
heroku
languages
openshift
service
aws
client
docker-compose
import-jdl
info
kubernetes
modules
server
upgrade
webapp
jasmine
mocha
But... none of these should be installed:
~/Documents/workspace/jhipster$ npm list -g --depth=0 | grep 'generator'
~/Documents/workspace/jhipster$
Where is yo finding these generators and how do I remove them???
Already tried:
npm uninstall -g yo
rm -rf ~/.nvm
Looks like you have multiple npm installed on your computer. This means that there's multiple global node modules folders.
You can run DEBUG=yeoman:* yo to get some insight into where those globally installed packages are.
As for the multi npm instances, you should delete the duplicated one.
Related
thank you in advance to solve my issue,
I am new to Craft CMS. just got a project and it is using fractal for template components build. on production when I update file in library it rebuild the components files in templates directory. but when i run the same command in my dev site terminal it is not rebuilding them. Note i am not getting any error.
on prod commands are :
npm run mix --production && npm run fractal:export && node replace.js
and on my dev I am running :
npm run mix && npm run fractal:export && node replace.js
I tried the same command as production but still not worked
I just setup a Rails Application in my Ubuntu 18 machine, and I want to connect it to Forest Admin. However, Forest Admin requires that I set up a Node Application using npm first. The node application requires the installation of Lumber CLI tool in order to install Forest Admin.
I have however installed Lumber CLI tool by running the command below:
npm install -g lumber-cli#latest -s
When I run the command below npm lumber -version in my command line terminal, I get the response:
6.13.4
But when I try to generate the Forest Admin using the command below:
lumber generate "my_project"...
I get the following error:
Command 'lumber' not found
I need some help. Thank you.
Here's how I solved it:
The issue is because NPM does not have the write access to the directory that will contain the package you want to install (here lumber-cli).
To solve this issue, override the default directory where your global NPM packages will be stored:
mkdir ~/.npm-global
Then, configure NPM to use this directory instead of the default one:
npm config set prefix '~/.npm-global'
Then, make the node executables accessible from your PATH. To do so, export the environment variable PATH by opening or creating the file ~/.profile and add this line at the end:
export PATH=~/.npm-global/bin:$PATH
Finally, reload the ~/.profile file:
source ~/.profile
Try installing lumber cli again using the command below:
npm install -g lumber-cli#latest -s
It should be able to install lumber without any error, and also display the directory where lumber-cli is installed.
Reference: Prevent permission errors at installation
That's all
I hope this helps
I am having issues deploying my elastic beanstalk rails 4 + ember cli app. I have a rails application and within the root I have a folder called 'frontend' which contains my ember app generated by ember CLI Rails.
My configuration:
64bit Amazon Linux 2015.03 v1.3.1 running Ruby 2.1 (Puma)
I encounter the following error from my activity log after I run eb deploy:
At cursory, I get this
ERROR: Instance: i-25c139e7 Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: (TRUNCATED)...mber-cli-rails.rb:58:in `compile!'
Looking into /var/log/eb-activity.log
I first get a lot of
npm ERR! Error: Attempt to unlock X, which hasn't been locked
followed by
npm ERR! System Linux 3.14.35-28.38.amzn1.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /var/app/ondeck/frontend
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/app/ondeck/frontend/npm-debug.log
npm ERR! not ok code 0
rake aborted!
EmberCLI Rails requires your Ember app to have an addon.
From within your EmberCLI directory please run:
$ npm install --save-dev ember-cli-rails-addon#0.0.11
in you Ember application root: /var/app/ondeck/frontend
Tasks: TOP => assets:precompile => ember:compile
(See full trace by running task with --trace) (Executor::NonZeroExitStatus)
So I ssh into the directory indicated and run npm install, which also leaves me with a lot of errors regarding authorization. When I run with via sudo, the modules install correctly, but when I redeploy my app, it gives me the exact same error.
I have tried sudo NPM install and chown -R node_modules webapp so that the node_modules folder can be accessed by the webapp group with no success.
I hate long answers, but this scenario is quite complicated.
As mentioned in the comments above, it was discovered that the home directory for the webapp user needed to be created (/home/webapp). Once this directory is created, the node package manager (npm) can execute without error. Because AWSEB environments can scale, SSH'ing into the EB host and performing one-off installations of packages and modules will not work in the long run. Essentially the answer boils down to the following logical steps:
Install git on the application server because bower needs it.
Create the home directory of the webapp user at /home/webapp.
Install bower globally using npm.
Invoke the npm install of your ember app.
Invoke bower install for your ember app.
To fix this I went ahead and created several .ebextensions customization files that are executed during an eb deploy. Here they are in order:
.ebextensions/00_option_settings.config - sets some EB options; for example the timeout length for command executions performed during an eb deploy. In this case all commands will timeout after 1200 seconds.
option_settings:
- namespace: 'aws:elasticbeanstalk:command'
option_name: 'Timeout'
value: '1200'
.ebextensions/01_packages.config - can install packages through yum and make them available to your eb instance. In this case I use yum to install git, this will later be used by bower.
packages:
yum:
git: []
.ebextensions/02_commands.config - allows you to run OS commands prior to unpacking the application that was uploaded through eb deploy. This part of the answer satisfies the main theme of this question: In my particular case, I need to create the /home/webapp directory, make sure it is owned by the webapp user, and also has 700 permissions. Lastly, I ensure that bower is installed globally as it will be needed by my ember application.
commands:
01_mkdir_webapp_dir:
# use the test directive to create the directory
# if the mkdir command fails the rest of this directive is ignored
test: 'mkdir /home/webapp'
command: 'ls -la /home/webapp'
02_chown_webapp_dir:
command: 'chown webapp:webapp /home/webapp'
03_chmod_webapp_dir:
command: 'chmod 700 /home/webapp'
04_install_bower_global:
command: 'npm install -g bower'
.ebextensions/03_container_commands.config - runs OS command after the application has been unpacked. NOTE: My ember app lives in the frontend directory of application source code. In order to install the npm and bower dependencies, the npm install and bower install commands need to be executed from the frontend directory. It is also worth mentioning that the bower-install command needs the --allow-root flag in order to succeed as the AWS user executing these commands has elevated privileges.
container_commands:
01_npm_install:
# set the current working directory to fully-qualified frontend
cwd: '/var/app/ondeck/frontend/'
command: 'npm install'
leader_only: 'false'
02_bower_install:
# set the current working directory to fully-qualified frontend
cwd: '/var/app/ondeck/frontend/'
command: 'bower --allow-root install'
leader_only: 'false'
03_seeddb:
# seed my database (has nothing to do with this answer)
command: 'rake db:seed_fu'
leader_only: 'true'
When I try to create a jhipster application in ubuntu 13.10 with yo jhipster the generated output files are always dumped in the wrong directory.
For example I run yo jhipster in the directory /mnt/mercury/jhipster-test/alpha then the files are dumped out to /mnt/mercury. In fact if I run yo jhipster in any subdirectory of /mnt/mercury they are always dumped out to /mnt/mercury.
I'm using yo version 1.1.2 from the standard ubuntu repository
Please advise how to generate files to be output in current directory.
For the benefit of anyone else facing this problem.
I managed to get Yeoman working with the following
npm cache clean
sudo npm rm -g yo
npm cache clean
sudo npm install -g yo
My problem: Accidentally "yo generating" in the parent directory.
Solution: Delete the .yo-rc.json file in the parent directory, then running the yo generator command in the child directory.
As discussed in the comments, this is a Yeoman problem on Ubuntu 13.10:
We don't have this issue with Ubuntu 12.04
There is the same issue with other generators ("yo webapp") on Ubuntu 13.10
As a workaround, I recommend you have a look at our Docker container:
https://github.com/jhipster/jhipster-docker
This will allow you to run the full JHipster stack, with Ubuntu 12.04, inside a container! Just use it to generate the app, then you can work directly on your host machine.
On Mac OSX Maverick with Node v0.10.26, yo v1.1.2 and generator-jhipster v0.11, the yo hipster command was generating all the sources always in the same (wrong!) directory and not using my current directory.
I fixed this problem doing the following:
cd <WRONG_DIR_WHERE_CODE_IS_CREATED>
rm .yo-rc.json node_modules/
npm uninstall -g karma
npm install -g karma (Note: using sudo it was not working!)
sudo npm install -g generator-jhipster
Not sure why but I've then been able to install karma and generator-jhipster again and suddenly yo hipster starting generating code again in my current directory
Could it be caused by different environment variables when launching npm with sudo?
The file .yo-rc.json is hidden, if it is not deleted, the generator will constantly take the settings from it. You must delete .yo-rc.json.
I'm having a problem with yeoman on a couple platforms (Mac OS, Ubuntu).
Basically, the conundrum is that yo can never install generators because it tries to use the -g option but it needs root access in order to do that. However, you cannot run sudo yo. I imagine the "update generators" option would probably fail as well.
How do I fix it so I can do everything I need within yo, instead of quitting and manually running sudo npm install -g generator-webapp (e.g.)?
I was having the same problem in my work laptop with MAC OS, I changed the owner and group of the .npm folder: /Users/eduardoc/.npm, to match my username and group. The -g option worked perfectly after that.