I am trying to use the generator of generatos, the generator-generator, and I am facing an error.
henrique#liberato:~/Documents$ yo generator
? Your generator name (generator-documents)
events.js:154
throw er; // Unhandled 'error' event
^
TypeError: this.env.adapter.prompt(...).then is not a function
at Base.prompt (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:232:45)
at askName (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/inquirer-npm-name/lib/index.js:25:19)
at module.exports.generators.Base.extend.prompting (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/app/index.js:21:12)
at Object.<anonymous> (/home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:431:23)
at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/run-async/index.js:26:25
at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/run-async/index.js:25:19
at /home/henrique/.nvm/versions/node/v5.8.0/lib/node_modules/generator-generator/node_modules/yeoman-generator/lib/base.js:432:9
at processImmediate [as _immediateCallback] (timers.js:383:17)
Versions:
henrique#liberato:~/Documents$ node -v
v5.8.0
henrique#liberato:~/Documents$ npm -version
3.8.9
I already did npm cache clean and npm install -g yo/yeoman-generator/generator-generator. Already reinstaled node and npm.
Thanks for your time :)
You need to update yo to the latest version.
npm -g update yo
And if that doesn't work, then you want:
npm -g uninstall yo
npm -g install yo
I had similar issue. However, updating or re-installing yo didn't help me.
My node environment is managed by nvm, where I am currently using node v6.2.0. However, yo was installed long ago in my pc while I was using node v4.4.1. When I used v4.4.1, I didnt get the error.
So, conclusion is that the yo angular-fullstack commands are working in the same node version in which it was installed. As nvm is handy in switching between node version, its not a big deal for me. I use v4.4.1 only when i generate some angular components, and switch back to the latest version.
I had this issue too.
I'm also using nvm to manage my node versions.
In my case, some combination of npm dedupe -g, npm update -g yo, npm uninstall -g yo, and npm install -g yo did the trick.
I also re-reran npm link from my generator, since it is a local generator. I think if it's a generator you installed from npm, npm uninstall -g <generator-name> followed by `npm install -g would serve the same purpose.
At some point during all this, the generator started working again, but I didn't notice exactly when, because I was running the generator as a part of my unit tests.
Eventually, I realized that the generator was working when I ran it from the command line, but not when I ran it from my test files.
At that point, updating yeoman's test helpers (npm update yeoman-test) from 1.1.0 to 1.4.0 did the trick.
Related
While installing the dependencies of vue-cli, vue is not identified. Why?
rm -rf node_modules and npm install again
have a look here
Add sudo before yarn when installing
yarn global remove #vue/cli
sudo yarn global add #vue/cli
vue
I had the same issue for a while.
TL;DR
npm install #vue/cli-service --save-dev
As the documentation specify it is a development dependency https://cli.vuejs.org/guide/#cli-service
The CLI Service (#vue/cli-service) is a development dependency. It's an npm package installed locally into every project created by #vue/cli.
Origin
I had a fresh install of nodejs
And just did
>> sudo npm install -g #vue/cli#latest
>> vue --version
#vue/cli 4.5.8
The issue
The issue presented like this
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
/bin/sh: 1: vue-cli-service: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The fixes:
npm install #vue/cli-service --save-dev
Which led me straight to another error message
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
ERROR Error: Cannot find module 'vue-template-compiler/package.json'
Which I fixed the same way
npm i vue-template-compiler --save-dev
And now it is working fine.
Installing current version without permanently installing vue-cli.
npx #vue/cli create appname
It shows the vue executable is located at /home/alisha/.local/bin. So probably this location is not there in your $PATH.
You should be able to run the vue commands if you provide the full path, like:
~/.local/bin/vue create hello-world
You can also see if that directory is in your PATH by running some command like:
echo $PATH | grep '.local/bin/'
If it's there, you would see it, otherwise you can add it to your path by placing it in your ~/.profile.
Edit ~/.profile and add the following at the bottom of it.
PATH="$HOME/.local/bin:$PATH"
Hope it helps!!
I had the same issue while making a build for production.
You will require vue-cli to be installed. Use below command to install the latest version.
npm install -g #vue/cli#latest
Then
npm install
Might have to do with you having an old version on your computer:
Warning regarding Previous Versions
The package name changed from vue-cli to #vue/cli. If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with
npm uninstall vue-cli -g or yarn global remove vue-cli.
You can find it here: https://cli.vuejs.org/guide/installation.html
THIS FIXED THE ISSUE FOR ME:
After running
sudo npm install -g #vue/cli
I ran
sudo nano $HOME/.profile
and pasted the following line
export PATH=$PATH:/home/chike/.npm-global/bin
after writing the code, next thing I did was Ctrl + O, ENTER and Ctrl + X then wrote
vue init webpack myapp
When you install vue using cli that time you got the path of vue.Now you can copy the bin folder path.
In my example /home/sublime/.npm-packages/bin
Now you export the path below command
export PATH=$PATH:/home/sublime/.npm-packages/bin
I solved mine by running (add sudo if needed)
npm i -g vue-cli#2.9.6
npm i -g #vue/cli
Got similar issue when deploy vue project in jenkins.
Here is what I did:
Add node's bin/ dir, to jenkins user's .bashrc file.
e.g
# node
NODE_HOME=/home/dev/.nvm/versions/node/default
PATH=$NODE_HOME/bin:$PATH
Tips - about nvm & yarn
When you manage node version via nvm, make sure you already choose the node version in terminal. e.g:
nvm use stable
node -v
If you use nvm, and installed yarn via npm, then better install vue-cli via npm not yarn, otherwise the vue executable is not placed into node's bin/ dir, at least that's the case in my tests, and as a result will cause you fail to find the vue command.
Using Yarn on Ubuntu it is installed to ~/.npm-packages/bin/. You must add this directory to your PATH. For example run the following command, close your terminal and open a new one.
user#machine:~$ echo 'export PATH="$PATH:~/.npm-packages/bin/"' >> ~/.bashrc
Note: if the file ~/.bashrc does not exist then simply create it.
Following worked for me:
First remove all the existing ones:
yarn global remove #vue/cli
yarn global remove #vue/cli-service
sudo yarn global remove #vue/cli
sudo yarn global remove #vue/cli-service
Then add #vue/cli using sudo:
Note: use sudo if required
yarn global add #vue/cli
yarn global add #vue/cli-service
Then, the final thing to do is to RESTART the terminal.
vue --version
#vue/cli 4.5.9
If you already got a project, the only two things you need to do is:
Delete the directory node_modules (it is safe, since it is not under git and will regenerate in the next step)
In the command-line write yarn install (it will install everything you need)
If you start installing vue-cli manually in a existing project, it the package.json and package-lock.json will be updated. If you already did. Do a checkout from git, and follow my steps above
This may be a problem caused by version conflicts. "export PATH=$PATH:" This is really useful in some cases. But if you are also like me, after trying the direct “export path” method in the comment above, restarting the terminal still can not execute the situation, you can try this way.
Uninstall Vue
npm uninstall -g #vue/cli
Check the local-global npm package installation path, vue is installed in this directory, check if it has been removed.
npm root -g
Install vue (you can check with https://cli.vuejs.org/#getting-started to find the latest command)
npm install -g #vue/cli
Create a connection to the /usr/local/bin directory(You need to find the vue.js path after the local installation first, then replace this path with your latest local install path:/Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js)
ln -s /Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js /usr/local/bin/vue
View version number
vue -v
I was getting the same error because Node.js was not installed. My issue got resolved by installing Node.js using the following command:
sudo apt install nodejs-legacy
To see if you already have Node.js and npm installed and check the installed version, run the following commands:
node -v
npm -v
If both are installed then follow the steps here:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
I installed the package using yarn global add #vue/cli on my Ubuntu box and found the binary in /home/vonkad/.yarn/bin.
I had to modify my /home/vonkad/.bashrc and add the directory to the path export PATH=$PATH:/home/vonkad/.yarn/bin.
To fix this situation, I had to add the following line to my .zshrc (maybe in your case is .bashrc)
export PATH="$(yarn global bin):$PATH"
Effectively, the yarn global bin is a folder where vue (vue-cli 3) was placed.
What helped me
mac os catalina with zsh terminal
Uninstalled node and npm using https://www.positronx.io/how-to-uninstall-node-js-and-npm-from-macos/
Downloaded node/npm from https://nodejs.org/en/download/current/
sudo npm install -g #vue/cli
vue --version (#vue/cli 4.5.4)
I faced the same issue and now resolved. In my case I installed Node.js and NPM using the default Ubuntu repository by using this command sudo apt-get install nodejs npm
The problems seemed like those 2 packages are not well maintained so it caused some bugs.
So I purge those packages and reinstall it from nodesource which is officially recommended way to install (reference: Installation instruction from nodesource) using these commands.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Then reinstall #vue/cli again
sudo npm install -g #vue/cli
Now these issues have gone. Hope it helps some programmers.
You need to install vue via sudo like explained in the doc:
https://cli.vuejs.org/guide/installation.html
If you have WSL2 running and you use zsh like me, just add
yarn global add #vue/cli
# add this line to ~/.zshrc
export PATH="$HOME/.yarn/bin:$PATH"
$ vue --version
#vue/cli 4.x.xx
You can try the following code install see
npm install --global vue-cli
vue init webpack <YOUR-PROJECT-NAME-HERE>
cd <YOUR-PROJECT-NAME-HERE>
npm install
npm run dev
As the title says, I cannot run create-react-app.
You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
Doing this does not change the error. npm uninstall -g create-react-app
I entered this command to try it out and got a message that the tar was out of date.
npm install -g create-react-app
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code EEXIST
npm ERR! path /opt/homebrew/bin/create-react-app
npm ERR! EEXIST: file already exists
npm ERR! File exists: /opt/homebrew/bin/create-react-app
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
https://www.npmjs.com/package/tar
I ran the command with this reference.
However, the tar was not updated.
I have already tried all the published solutions, but they don't work. Can someone please help me? Please.
I tried clearing the cache but could not solve the problem.
npx clear-npx-cache
Need to install the following packages:
clear-npx-cache
Ok to proceed? (y) y
I was able to successfully run the following command by specifying the version each time, but it is a hassle and I want to be able to run it normally.
npx create-react-app#latest my-app
The "fish" shell I am currently using is node v18.0.0, so I downgraded to v16.15.0 and it works fine.
fisher install jorgebucaran/nvm.fish
nvm install v16
I had forgotten to lower the node version in fish because it had been working fine with zsh.
I'm trying to start my first Gatsby project but keep encountering the same error when creating a new project.
After running gatsby new project-1, I get the following error:
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tom.allen/.npm/_logs/2020-06-18T15_54_40_537Z-debug.log
ERROR
Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
- error.js:56 makeError
[lib]/[gatsby-cli]/[execa]/lib/error.js:56:11
- index.js:114 handlePromise
[lib]/[gatsby-cli]/[execa]/index.js:114:26
- task_queues.js:97 processTicksAndRejections
internal/process/task_queues.js:97:5
- init-starter.js:139 async install
[lib]/[gatsby-cli]/lib/init-starter.js:139:7
- init-starter.js:206 async clone
[lib]/[gatsby-cli]/lib/init-starter.js:206:3
- init-starter.js:345 async initStarter
[lib]/[gatsby-cli]/lib/init-starter.js:345:19
- create-cli.js:400
[lib]/[gatsby-cli]/lib/create-cli.js:400:7
I have tried deleting the node_modules inside the project folder and running npm i again but I can't work out how to fix this issue. I'm on node v12.17.0 if that makes a difference... Any help will be really appreciated!
Install nvm
We strongly recommend using a Node version manager like nvm to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.
npm's docs
If you have installed Node via some package manager or some Node installer, first of all, uninstall it and instead install Node from nvm. In my case I had installed Node via NodeSource, so:
sudo apt purge node
Go ahead and install nvm, following the instructions on the Github repo. I had to include the shell script manually in my ~/.zshrc because the nvm script didn't do.
Install node and npm via nvm
Run the following to install Node and npm: nvm install node
Now, in order to make gatsby new works, you will need to install a previous version of node, which will be: v14.13.1. Run the following command and you will install the mentioned version:
nvm install 14.13.1
Select the Node version to use if is not selected:
nvm exec 14.13.1 node --version
Gatsby
Now, you only need to install Gatsby CLI, and then simply use it.
Run the following: npm install -g gatsby-cli
Go to the folder where you want to create your project and then run:
gatsby new [your-project-name] https://github.com/thomaswangio/gatsby-personal-starter-blog
So there's a few suggestions:
Hard cache removal: npm cache clean --force
Upgrade gatsby-cli version: npm update
Delete node_modules and .cache folder
Keep in mind removing package-lock.jsonto unlock you dependencies.
I literally just made a fresh installation of the Angular CLI in order to try it out and I don't have a clue on what's causing the following error on the command line:
PC:cobros Fran$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
95% emitting/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
callbacks[i](err, result);
^
TypeError: callbacks[i] is not a function
at Storage.finished (/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15)
at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9
at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/graceful-fs/polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:153:5)
This is the information I get returned when I try "ng -v" (In case it's useful at all):
Angular CLI: 1.6.8
Node: 8.9.0
OS: darwin x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
#angular/cli: 1.6.8
#angular-devkit/build-optimizer: 0.0.42
#angular-devkit/core: 0.0.29
#angular-devkit/schematics: 0.0.52
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.9.8
#schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
What does the 'enhanced-resolve' module even do?
Did I install angular wrong? I followed the instructions from https://github.com/angular/angular-cli and made sure I fulfilled the prerequisites.
EDIT: The issue is now fixed, so there is no need to use this workaround anymore.
Solution (workaround) found here
Add "copy-webpack-plugin": "4.3.0" to your package.json
Thanks #neshkatrapati
I had same problem and this command did miracle for me
npm install copy-webpack-plugin#4.3.1
This issue should now be resolved with v4.4.1 released just now.
https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v4.4.1
EDIT: The issue is now fixed, so there is no need to use this workaround anymore.
Happens after upgrading #angular/cli to 1.6.8.
Solution: Problem is with copy-webpack-plugin (https://github.com/webpack-contrib/copy-webpack-plugin/issues/217)
npm i copy-webpack-plugin#4.3.1 --save-dev helps
NOTE: Previous offered solution was to downgrade cli to 1.6.7, which does not help.
As stated here https://github.com/angular/angular-cli/issues/9550 it's a problem with copy-webpack-plugin.
It can be solved by doing npm install copy-webpack-plugin#4.3.0
Following github.com/angular/angular-cli/issues/9550 (thanks #oers for the link in the comments)
I just downgraded Anuglar CLI to version 1.6.7.
To do so, just type
npm uninstall -g #angular/cli
And once it finished install a previous version
npm install -g #angular/cli#1.6.7
NOTE: This will work but it is just a temporary solution, they probably -and hopefully- hot fix this.
EDIT: Actually I tried the wrong project which wasn't using CLI, tried again and it doesn't work, if you follow the github thread, it looks like a big thing, as it doesn't work with CLI 1.5.x nor 1.6.x (didn't tried with the others). It looks like the only thing we can do ATM is either debug through or sit and wait.
OOPS!
if npm install copy-webpack-plugin#4.3.1 doesn`t help try add in package.json:
"optionalDependencies": {
"copy-webpack-plugin": "4.3.1"
},
"resolutions": {
"copy-webpack-plugin": "4.3.1"
}
Edit
Just execute yarn upgrade.
There was a release of copy_webpack_plugin fixing the bug (4.4.1), so this should be preferred for resolving this issue. With npm, npm --depth 9999 update should do the trick to update all dependencies recursively.
Regarding the depth argument for npm update:
As of npm#2.6.1, the npm update will only inspect top-level packages. Prior versions of npm would also recursively inspect all dependencies. To get the old behavior, use npm --depth 9999 update
Original answer below:
Solution
rm -rf node_modules package-lock.json
npm i copy-webpack-plugin#4.3.1 -E -O
npm i
Explanation:
We remove node_modules and lockfile
We specify copy_webpack_plugin only as a peer dependency (option -O) and with an exact version (option -E)
We install node_modules
Try this command -> npm install copy-webpack-plugin#4.3.0 resolved my issue
run this command npm install copy-webpack-plugin#4.3.0
callbacks[i](err, result);
^
TypeError: callbacks[i] is not a function
solution:-
npm install copy-webpack-plugin#4.3.0
Try to uninstall and reinstall Angular CLI :
Global package:
npm uninstall -g #angular/cli
npm cache clean
if npm version is > 5 then usenpm cache verifyto avoid errors (or to avoid using --force)
npm install -g #angular/cli#latest
Local project package:
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev #angular/cli#latest
npm install
I have been using mean.js version 0.3 with no problems up untill now. Today I decided to checkout mean.js 0.4 so I ran
npm install -g generator-meanjs
to install the new version of the generator, and then ran
yo meanjs
and I went through the steps of the generator which finished successfully, and I was able to run the example site.
However, when I tried to use yo to create my own modules with the following command:
yo meanjs:vertical-module customer
It runs the application setup again:
You're using the official MEAN.JS generator.
? What mean.js version would you like to generate? (Use arrow keys)
master
❯ 0.4.0
0.4.1
I tried looking for a solution, and the only thing I found was this issue:
https://github.com/meanjs/generator-meanjs/issues/79
That suggested the cause is multiple versions of the generator is installed, so I tried uninstalling with the following command and then re-installing by repeating steps I described above
npm unstall -g generator-meanjs
But I am still getting the same results
I would really appreciate any suggestions as to how resolve this. TIA!
I had the same problem, finally figured it out. Maybe it will work for you too:
# remove meanjs generator from npm global
sudo npm remove generator-meanjs -g
sudo npm cache clean -g
# figure out where my npm global modules are
npm root -g
Result: /usr/local/lib/node_modules
# cd to the npm global directory
cd /usr/local/lib/node_modules
# get the latest Yo generator code from GitHub
sudo git clone https://github.com/meanjs/generator-meanjs
# switch to the 0.4-dev branch
cd generator-meanjs
sudo git checkout origin/0.4-dev
#install (run while in generator-meanjs dir)
sudo npm install
# test it
cd ~/
mkdir tmp
cd tmp
yo meanjs:vertical-module my_crud_module
try to install the following version of meanjs generator
npm install -g meanjs/generator-meanjs#0.4-dev
then use
yo meanjs:vertical-module customer
i think that will help.
After hours of haunting errors I managed to find a way to generate crud module. As you guys know 0.4.x generators are still under development so there's a way to create another meanjs project folder with 0.3 version. You can downgrade to meanjs 0.3x without destroying the meanjs 0.4 project folder. All you have to do is to downgrade generator-meanjs to 0.1.12 version and downgrade yo to 1.3.3 or the versions till january 2015.
You can find the information about versions through:
sudo npm info -g yo
sudo npm info -g generator-meanjs
I came up with a hack to fix this issue:
1. Install the crud module when creating your meanjs application:
yo meanjs
this will install an articles crud module in the modules directory.
2. Replace all keywords article by name in all files.
3. Rename all filename with name instead of 'article' in the articles directory.
I have posted a video where I explain these steps in details:
https://www.youtube.com/watch?v=Nkpdp1ofux8