I had installation issues of angular-cli on Windows 10 system.
The errors were related to Python dependencies and node-gyp. Something as below :
>execSync#1.0.2 install C:\Users\UserName\AppData\Roaming\npm\node_modules\angular-cli\node_modules\execSync
node install.js
[execsync v1.0.2] Attempting to compile native extensions.
{ Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:1007:11)
Update
this seems to be fixed in newer releases and this solution is no longer required.
mukesh51 eventually solved the problem.
the installation seems to work in these steps:
npm install -g node-gyp
npm install -g windows-build-tools
npm install -g #angular/cli
I took these steps from here.
Uninstall
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
Update Global package
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
I too faced the same issue initially when I installed angular directly using bash. The installation was error completely. Then I attempted to install locally in my project (without removing the global one). That appeared to have solved the problem but got an error on creating a new app.
So i uninstalled everything :
npm uninstall -g #angular/cli
and the reinstalled Angular using Windows Power Shell(as Admin)
npm install -g #angular/cli
This solved the entire problem! Hope it helps!
Use windows power shell to install angular-cli. It will run without any issues.
Windows 10 Solution
Look back at the trace of installation steps ... you may see that it found the Angular binary in the following location:
C:\Program Files\Git\usr\local\node_modules\#angular\cli\bin
I added an ENVT variable using this path and ng worked fine after that
I tried using npm install -g #angular/cli
npm downloaded files successfully and copied files to AppData but not able to use ng -v
After that, I tried following:
npm cache clean --force
Removes npm cache forcefully if you get warning using npm cache clean.
Then try
npm install -g #angular/cli#latest
I have successfully installed by trying the above solution in Windows10.
Both the CLI and generated project have dependencies that require Node 8.9 or higher, together with NPM 5.5.1 or higher.
try update node.js and npm
npm uninstall -g #angular/cli
npm install -g #angular/cli
if doesn't work:
Close the terminal, open a new one or use CMD or Git for windows instead.
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
I tried installing create-react-app using npm i create-react-app, npx create-react-app new-app and npm init react-app new-app, but I keep getting this error message:
You are running create-react-app 4.0.0, which is behind the latest
release (4.0.1). We no longer support global installation of Create
React App.
How can I fix this?
This worked for me:
npx create-react-app#latest your-project-name --use-npm
According to the create-react-app docs, create-react-app should not be installed globally:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
This is even stated in the error message you recieved:
You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).
We no longer support global installation of Create React App.
You must uninstall create-react-app with npm uninstall -g create-react-app.
Then each time you want to create a new React app with create-react-app, use the command npx create-react-app my-app.
So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app.
Run this in your terminal:
npm uninstall -g create-react-app && npm i -g npm#latest && npm cache clean -f && npx create-react-app#latest my-app --use-npm
I got
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
so I simply called the package with an explicit version:
npx create-react-app#5.0.0 app-name
I also faced this issue after they released v4.0.2.
They have mentioned this:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
I resolved the issue by following the below steps:
Uninstall create-react-app v4.0.1:
# for npm:
npm uninstall -g create-react-app
# for yarn:
yarn global remove create-react-app
You are not required to install create-react-app in your local directory, so if you do not want to do this then move to step 3. If you want to do this, install v4.0.2 without using the global flag (-g or --global) using the below command:
# for npm:
npm i create-react-app
# for yarn:
yarn add create-react-app
You can now create a new React app using the below command:
# for npx:
npx create-react-app my-app
# for npm:
npm init react-app my-app
# for yarn:
yarn create react-app my-app
I also face the same problem but the problem gets solved when I uninstall the create-react-app globally and then again install it globally.
Uninstalling Command:
npm uninstall -g create-react-app
installing Command:
npx create-react-app my-app
if you have an older npm version (npm version < 5.2) then use this command :
npm install -g create-react-app
it solved my problem I hope it will solve yours
Updating NPX worked for me. Suggestions on this page didn't do the trick but might have contributed.
npm update npx
What worked for me was:
npm uninstall -g create-react-app
And then:
npm i create-react-app # or yarn add create-react-app
I also updated the Node version.
Uninstalling create-react-app globally via npm and reinstalling without the global flag did not work for me.
npm uninstall -g create-react-app
npm install create-react-app
I was on node version 15.2.0. I upgraded to the latest stable node version 15.3.0 via nvm.
nvm install node
Then I installed create-react-app again (no global flag).
npm install create-react-app
I was then able to successfully create a new react app.
npx create-react-app my-app
EDIT: The above will install create-react-app to your current directory. To be clear, after uninstalling create-react-app globally I was no longer able to create an app via npx and received the same original error message. The best solution I've found so far is to run npm install -g npm#latest which downgraded my npm version from 7.0.14 dev build to 6.14.9 LTS build and allowed me to create the react app via npx without issue.
npm uninstall -g create-react-app
Although the uninstall command ran successfully , it was not able to uninstall create-react-app, so i kept running into the same error again and again
This finally worked for me npx create-react-app#latest my-app --template typescript
After create-react-app > 4.0.1 use these commands
npm
npm init react-app my-app
yarn
yarn create react-app my-app
Getting Started | Create React App Docs
I have nvm installed, and while using the command npx create-react-app my-app; I got this error:
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).
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
I confirmed that I did not have create-react-app installed globally in my nvm global directory.
I solved issue by specifying the version of the package
npx create-react-app#4.0.2 my-app
For me it was the issue with my npm version. So i did this:
npm install npm#latest -g
Now npx create-react-app app_name works.
I had to downgrade to the latest stable version of node with n in order to make it work.
sudo n stable
Just to make it clear, I never installed it globally, I just had this problem after upgrading node.
There are two different causes of this error:
You have create-react-app installed globally. Use this command to find out if you do: npm list -g --depth 0. If so, follow the instructions in the error message to uninstall it globally.
You are using node v15.0.0+. Use NVM to switch to the LTS nvm use --lts and then run create-react-app. After that you can switch to v15.0.0+ and continue working. (If you do not have NVM installed, here is how you can install it: https://github.com/nvm-sh/nvm)
For me I got the same error even though create-react-app was installed in a parent directory, not globally. So I ran npm uninstall create-react-app without the -g flag and it worked.
Using Git Bash on Windows i run into the same issue today
npx create-react-app appname
even didn't worked after i uninstalled the global installation with
npm uninstall -g create-react-app
What solved the problem for me was to clean the npm cache with the following command
npm cache clean -f
This worked for me.
sudo npm uninstall create-react-app -g
sudo npm install create-react-app#5.0.0 -g
npx create-react-app my-app
I know I'm late to the party, but here are my two cents to help you. This is how I made it worked
Uninstall Global create-react-app installation
npm uninstall -g create-react-app
Now clear the npx cache by
npx clear-npx-cache
Now try to create the application; if you still get the error saying we don't support create-react-app, change the directory to create the application
run
npx create-react-app my-app
This is how I made this worked
i was facing same issues a while ago
npx create-react-app#latest app-name
worked for me
Solution-1: Update your node package manager by using the command below.
npm install -g npm#latest
npx create-react-app my-app
Solution-2: Run your PowerShell as administrator and run the commands. Something this will not work
npm uninstall -g create-react-app
npm install -g create-react-app
//OR
npx create-react-app my-app
Solution-3: The permanent solution is to uninstall node.js and NPM and install them once again.
enjoy
use this :
npm install create-react-app
I ran into this myself today and my root cause is likely very rare but perhaps it will help someone else.
I had an npm registry defined in my .npmrc which my work requires us to use. Turns out my work mirror didn't have 4.0.1 and something in create-react-app must phone home and run a version check.
If you have a registry defined run npm view create-react-app to check the latest version.
After exploring the Github issues a bit I found a solution to this problem that was posted, which doesnt require downgrading node or npm.
I'm using Ubuntu on WSL2 so keep in mind locations might vary. The problem comes from npm having cached a global installation of create-react-app with npx that is v4.0.0 which doesnt show when you use npm view create-react-app.
If you find your npm cache which for me was located in ~/.npm/_npx/ folder, you will find folders with hashed names from all your global installs where you have used npx previously.
If you look through each of them for example with cat [hash]/package.json and note down the hash of any that contains create-react-app. Now go ahead and manually edit the package.json files to bump the version of create-react-app to 4.0.1 - and afterwards remove it from node modules with rm -rf [hash]/node_modules/create-react-app.
After this if you go back out and try to run npx create-react-app my-app it will prompt you to install 'create-react-app' as normal and should work fine, and now npx will have cached the correct version of 'create-react-app' so you wont have the issue again either. And you can use whichever version of node and npm you like.
If you're on Windows or Mac you have to figure out where the cache is located, as I don't know - but the rest of the steps should be the same.
i didn't have any global create-react-app i just did npm uninstall -g create-react-app and then i did npm install create-react-app
I ran into the same problem and the error isn't quite as explanatory as it should be. I fixed it by updating npx itself.
Please type in npm update npxin your terminal to resolve the problem.
After that you can type in npx create-react-app "your preferred project name" to create your react project.
I've uninstalled create-react-app globally also from yarn
npm uninstall create-react-app -g
And the reinstalled create-react-app
npm i create-react-app
or another way is:
npm create-react-app#latest my-app
npm create-react-app#4.0.2 my-app
The other answers didn't work for me. Trying to uninstall globally, for instance, might work to uninstall it but the error persists. It persisted across new installations of Node, and so on.
However, the following seems straightforward and worked for me:
Go into some fresh folder, in which you'll create the app, so that it doesn't already know about create-react-app.
yarn add create-react-app
yarn run create-react-app myapp
SOLUTION:
Step # 1: Remove globally the create-react-app package:
npm uninstall -g create-react-app
Step # 2: Install again globally the create-react-app package:
npm install -g create-react-app
That will install the version 5.0.1 (or higher). To check if it was properly installed, run this on the terminal:
npm list -g
Result:

And then try again to create the react app, using the sentence:
npx create-react-app <project_name>
And then it will work.
This worked for me
npm uninstall -g create-react-app
then
npm install -g create-react-app
I uninstalled node.js and reinstalled it using windows installer. Now npx create-react-app command works like a charm.
Anything I try to do with NPM, I end up with npm ERR! Cannot find module './access-error.js'. Help!
I first noticed it when trying to install vue-chartjs. I ran npm install vue-chartjs chart.js --save like the docs said to do and got the error:
code/premium-poker-tools [master●] » npm install vue-chartjs chart.js --save
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './access-error.js'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamzerner/.npm/_logs/2019-03-12T23_56_46_114Z-debug.log
Then I tried installing chart.js and vue-chartjs individually, but it gives me the same error.
Then I googled the issue. I tried:
rm -rf node_modules
npm install
and it didn't work.
I tried reinstalling NPM and it didn't work. I tried removing NPM via sudo npm uninstall npm -g and then planning on reinstalling it after, and it didn't work. Everything I do gives me the npm ERR! Cannot find module './access-error.js' error.
This problem sounds very similar to one I had a few weeks ago.
What worked for me was removing Node.js from my Mac and reinstalling it, because installing Node.js installs npm as well.
Command used to remove Node.js: sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
Then just reinstall Node.js and everything should work again!
Hope this helps!
Ran into the same issue. Was using Node v8.11.4. Switched to Node v8.9.4 and it started working again...
Using NVM, I did the following:
nvm ls
nvm install <different version>
nvm alias default <different version>
Best guess is that it wasn't 8.11 specifically, but something with my particular installation was messed up and using a fresh install fixed it.
Not very satisfying. ¯\_(ツ)_/¯
I faced the same problem. Found that the node version is different.
Try the following:
1. nvm ls
2. nvm use <latest version available>
Now baam .. it works.
Using n to switch Node versions.
I've ran yarn, npm rebuild node-sass --force many many times. And still fails. Getting this error:
Node Sass could not find a binding for your current environment
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
Anyone have any idea how to fix?
Also..
When running this command..
npm rebuild node-sass --force
I get..
npm WARN using --force I sure hope you know what you are doing.
Doens't seem like it is doing anything..
I did below to resolve the issue.
npm uninstall node-sass
npm i node-sass
npm rebuild node-sass
remove node-sass from your command and just run npm rebuild --force
If npm rebuild node-sass and npm rebuild node-sass --force doesn't work. Just uninstall node-sass and install again.
I have tried all options like:
npm rebuild --force
npm rebuild node-sass --force
npm rebuild node-sass &
also did try to install through Python &
updated VS Project links, but nothing worked..
EXCEPT running it manually:
node node_modules/node-sass/scripts/install.js
The main issue is that your node-sass and node-npm versions are incompatible.
Please see the chart on this site or on this.
So my suggestion is either adjust your node-npm version or adjust node-sass.
In my case I was using node-sassof version 4.9.4 with node version 8.12.0 and npm version 6.4.1, It was working fine without any issue, later on I got new system and I had installed the latest node(12.16.0) & npm(6.13.4) and issue started so I dug into this and found above links.
Hope this will help you.
I just ran the command npm install node-sass and my issue was resolved.
remove package-lock.json file
remove node_modules folder
then remove from package.json it devDependencies
"node-sass": "4...",
then
npm i node-sass -D
and
npm i
We are also facing the same issue many times, due to different versions of node and npm for numbers of web applications.
For that, we are just using the below command to take proper node-sass supported versions.
npm install node-sass or npm install node-sass -g
then try to rebuild the node-sass with,
npm rebuild node-sass or npm rebuild node-sass -f
After that all, if required then we can rebuild all packages and npm start or npm run watch and then the application is working properly.
try this, add/modify your package.json
"node-sass": "*",
and run
npm install
Uninstall and reinstall node-sass. Consider moving to dart sass because node-sass is now deprecated.
Switching Node version to 12.18.x worked for me.
I solved it with npm rebuild node-sass --force, in my case I had to do it as sudo
I install AngularJs using the command npm install -g angular-cli and afterwards, when I was trying to create new project, I get the following error,
Cannot find module 'reflect-metadata'
What should I for resolve the error ?
I had to reintall nodeJS from their website and install reflect-metadata and portfinder using the following commands while being as superuser,
sudo npm install -g reflect-metadata
sudo npm install -g portfinder
Afterwards, I can create new project using the command,
ng new myProject
Upgrade npm by npm install -g npm.
If problem still exists try:
npm i -g reflect-metadata
Re-installing node.js worked for me.