'ng new my-app' error - javascript

I am trying to generate a new project and skeleton application using the latest version of Angular. I have tried uninstalling and reinstalling Angular CLI using:
C:\>npm install -g #angular/cli#latest
C:\>ng --version
#angular/cli: 1.4.5
node: 8.8.1
os: win32 x64
This error occurs when trying to run 'ng new my-app' in command prompt:
'Error: The command "new" has an option without the required type and name field'
Any help to resolve this issue is appreciated.

This is a known issue and there is an issue raised in github for this.
https://github.com/angular/angular-cli/issues/7984
Try below commands:
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest

After these steps:
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
Do:
npm install #schematics/angular
And then:
ng new appname

Related

Error while using create react app command

Even though everything used to work couple of weeks ago, now I can not successfully create new react app with its templates.
When I try to run npx create-react-app my-app command, it only creates the folder with package.json, pckage-lock.json and node_modules. The public folder is missing and also, when I try to run npm start, it gives me an error saying:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
before it used to say happy hacking and the template page with react logo was displayed.
I tried to uninstall and install node again, clear cache but nothing helped. Any advice? Thank you so much!
My npm -v is 6.13.4 and node -v is v12.14.0
If you have installed create-react-app globally. remove that globally from you system
Try these steps
npm uninstall -g create-react-app
npx create-react-app app_name
cd app_name
npm start
Note- npx comes with npm 5.2+ and higher, see instructions for older
npm versions
Check this reactjs documentation.
Faced the same issue and fixed it by following the below steps:
Try to uninstall all existing global installation of create-react-app and check that they are removed properly by using the two commands below:
command for uninstalling: npm uninstall -g create-react-app
command for checking: which create-react-app
command for manual delete: rm -rf <path where create react app is located>
Once all the versions are removed, use: npx create-react-app <name_of_the_app>
For more details refer here
First, update the npm and node using following commands:
npm install -g npm
npm cache clean -f
npm install -g n
n stable
Remove globally installed create-react-app using:
npm uninstall -g create-react-app
Use npx for using create-react-app directly:
npx create-react-app <project-name>
I was having the same issue, and saw a lot of the same answers saying to uninstall create-react-app globally and reinstall using npx create-react-app my-app.
Downgrading my version of Node to 8.11.1 is what fixed it.
sudo npm install -g n
sudo n 8.11.1
node -v
> v8.11.1
After that I ran npx create-react-app my-app and it worked as expected.

-bash: ng: command not found after installing #angular/cli using npm link #angular/cli#latest

I am using:
node -v
v10.15.3
npm -v
6.4.1
I have tried below mentioned command
command: npm i -g angular/cli
Error while executing: npm ERR! /usr/local/bin/git ls-remote -h -t
ssh://git#github.com/angular/cli.git
command: npm i -g #angular/cli
npm ERR! path /Users/admin/.node_modules/bin/ng npm ERR! code EEXIST
npm ERR! Refusing to delete /Users/admin/.node_modules/bin/ng:
../lib/node_modules/angular-cli/bin/ng symlink target is not
controlled by npm
/Users/admin/.node_modules/lib/node_modules/#angular/cli npm ERR! File
exists: /Users/admin/.node_modules/bin/ng npm ERR! Move it away, and
try again.
Make sure you have the correct path in Enviroment variable -> user variable like this
In this case my npm folder are located at
C:\Users\phuc.ngo\AppData\Roaming\npm
The npm folder is where everything you install can be found like angular cli, webpack, etc...
You need to try installing angular with admin previledge and try to install it globally with -g
npm install -g #angular/cli
after installation check the angular version
ng --version

npm Error! ENOENT: no such file or directory .dezalgo.DELETE'

Whenever I try to do anything with my NPM I keep on getting this error.
I try to install npm install -g --save vue-draggable
I have uninstalled node and npm and re installed and constantly having this issue.
npm ERR! path /Users/victor/Desktop/myprog/node_modules/jquery/node_modules/npm/node_modules/dezalgo
NPM Verson: 5.6.0
Node: v8.9.1
To anyone having this problem, its because NPM is version 5.6.0
Downgrade to:
Sudo npm install -g npm#4.6.1
I don't think that the accepted solution will solve the issue...
Somehow a dependancy representation in package-lock.json is wrongly described.
Removing the file package-lock.json and npm install could solve the issue.
I recommend that you use the latest version of npm : npm install npm#lastest.

Troubles with Angular CLI installing

I have installed node (v 8.5.0) with npm (5.3.0).
After that I made: npm install -g #angular/cli but it doesn't work:
ng help
-bash: ng: command not found
here are installation logs:
MacBook-Air:~ michael$ npm install -g #angular/cli
/Users/michael/.npm-global/bin/ng -> /Users/michael/.npm-global/lib/node_modules/#angular/cli/bin/ng
+ #angular/cli#1.4.3
updated 1 package in 39.276s
You can check out this issue on github.
It seems like they are running npm install again possibly needing admin privileges as well.

npm: not found when setting up Jenkins Server?

This is my first time setting up a jenkins server. The build is using Amazon's EC2 and Ubuntu 14.04.
I've installed node and npm via nvm.
node -v
>v0.11.14
npm -v
>2.0.0
The repo pulls down just fine into my /var/lib/jenkins/workspace/morningharwood folder.
Problem: When I add my script it breaks
Here's my build script which errors out? I have no idea what i'm doing. I copied this from a tutorial.
QUESTION: How do I properly write my script to npm install, bower install and lastly, grunt test
You could install node, npm, bower and grunt by doing following:
sudo apt-get install node
sudo npm install bower
sudo npm install grunt
To install a package from local source, use
npm install /path
Try using NodeJS plugin for Jenkins: https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin
This will solve npm command not found issue on jenkins even installed on server
sudo mkdir /usr/local/nvm
export NVM_DIR=/usr/local/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh |NVM_DIR=/usr/local/nvm bash
. /usr/local/nvm/nvm.sh
nvm install 10.15.3 -g
npm install #angular/cli -g
Include following on build execute shell command in jenkins:
export PATH="$PATH:/usr/local/nvm/versions/node/v10.15.3/bin"
npm install

Categories