Why am I unable to run yo angular successfully? - javascript

I am running a windows 8.1 64-bit machine.
Node and npm were installed.(latest versions 0.12.x and 2.7.x)
Installed YO BOWER GRUNT-CLI GULP GENERATOR-ANGULAR correctly.
Now when I run "yo angular", the project files are being generated and bower install and npm install` are running. Till now its fine.
bower install goes well. But npm install stuck in middle and gives different ERR (sample - ERR registry parsing json sometimes different) and finally it freezes executing phantomjs.exe forever. If I quit that cmd prompt and run grunt in that folder, it says grunt not installed.
This happened every time I run this. Tried almost all googled suggestions. One more thing is that I cannot delete that folders created by yo angular.
Kindly help me run it completely

Related

Integrate npm into VisualStudio

I got Linux. I have just installed Visual Studio and installed npm with it. However, when I type "npm init -y" into the Visual Studio console it says npm command not found. In the normal console I type npm version and it gives me back the version 3.5.2 though. So apparently I have not really integrated it into Visual Studio. Does anyone how to do so?
I had the same problem before... if you want to run npm commands you should go to a directory that your nodejs is installed... if you want to run npm commands in other directories you should go to the directory that you want and then run cmd and type in the commant
set path=C:\Program Files\nodejs\
then you can run all of the npm commands in your directory

npm wont start a react app, requires a dependency: "webpack-dev-server": "3.1.14"

I am trying to create a new react-app and start it, I have created react apps before with no errors but this time when i npm start i get this error
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"webpack-dev-server": "3.1.14"
Don't try to install it manually: your package manager does it
automatically.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
Manually installing incompatible versions is known to cause hard-to-debug
issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to
an .env file in your project.
That will permanently disable this message but you might encounter other
issues.
To fix the dependency tree, try following the steps below in the exact
order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your
project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack-dev-server" from dependencies and/or devDependencies in
the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the
above steps with it instead.
This may help because npm has known issues with package hoisting which may
get resolved in future versions.
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
7. Try running npm ls webpack-dev-server in your project folder.
This will tell you which other package (apart from the expected react-
scripts) installed webpack-dev-server.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in
your project.
That would permanently disable this preflight check in case you want to
proceed anyway.
P.S. We know this message is long but please read the steps above :-) We
hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! learnreact#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the learnreact#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ashraf\AppData\Roaming\npm-cache\_logs\2019-02-
04T20_36_39_924Z-debug.log
PS C:\Users\ashraf\Desktop\Files\LearnReact\learnreact>
i have tried all the steps in detail in the error log but its still not working, any thoughts on what is causing this error? Thanks in advance
It seems like you want to depend on webpack-dev-server inside your local project.
Perhaps you need to run npm install in your project, instead of your ~ home directory?
from your output, notice these lines.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
...
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
so I would
cd ./my-project
npm i
Did you install webpack-dev-server on its own? It seems it has been installed either by you or by another project install. Webpack is for your local development environment so the other install is close enough to your project to interfere with the copy that react is trying to install in your project folder. Steps 1-4 in your error message should resolve your issue. If you have done that and its still not working, did you get different error messages with your next attempt to install your react package?
I have faced the same issue and this method worked for me.
Do follow the steps:
Start terminal from the desktop and write this command:
npm uninstall webpack-dev-server
This will uninstall webpack-dev-server package globally from you node modules.
Go back to you the terminal of your project and install webpack-dev-server package:
npm install webpack-dev-server#version
Note: The version part (above) should equal the versions asked for in the error message.
npm install webpack-dev-server
Now start npm:
npm start
This error mostly occurs when you have created your project using the
npx create-react-app command instead of the npm create-react-app command.

Unable to run Electron Quick Start in WSL

Hi I'm running Ubuntu 16.04.3 LTS on Windows Subsystem Linux. I'm trying to run the Quick Start first app as listed in this section here https://electronjs.org/docs/tutorial/first-app however, I keep getting the same error no matter if I clone the repository, write it myself, or delete and reinstall the Electron module.
> electron .
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! first-electron#1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the first-electron#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
For reference I'm running
Node: 9.11.1
NPM: 5.8.0
Electron needs to open a chrome browser window. So, when you run it from WSL using a node.js that was installed in WSL, I guess it would try to start the chromium browser for Ubuntu, which will not work out of the box, because:
Microsoft doesn't support graphical programs on WSL. Bash on WSL is intended for running command-line programs that developers might need, but it's possible to run graphical Linux desktop programs on Windows using the Bash shell. To be more precise, you'll be able to display graphical programs running in WSL on a Windows 10 desktop by using an X server which runs on Windows 10.
https://virtualizationreview.com/articles/2017/02/08/graphical-programs-on-windows-subsystem-on-linux.aspx
I found the easiest way is to install electron on Windows then start it from WSL.
Steps:
Make sure you have Node.js & npm installed on your Windows machine (you can remove them afterwards)
Open cmd.exe, move to your project directory and run npm install electron --save-dev.
This will install the Windows version of the prebuilt Electron binary instead of the Linux one, which would occur if you try to install from WSL. (This is the actual trick)
Enter Bash on Ubuntu on Windows, move to your project directory then run ./node_modules/.bin/electron (or use an npm script) to launch your Electron app
Though, I'm not sure this is very convenient, it seems to work well.
I hope this will help people encoutering the same issue in the future!
Ref: https://github.com/electron-userland/electron-prebuilt/issues/260
run a X-server app in windows, then export DISPLAY , run the npm start.

Error install Angular 4 using npm

When i install angular and try to use this command line :
ng -v i got an error (check jpeg file) ..
I have installed : node 6.10.3
someone have a solution
Those errors are caused by you manually stopped #angular/cli from installing packages into your project folder.(When running ng -v in a angular/cli project folder, angular/cli will trying to output your version information of installed #angular/xxx packages).
mention that when you pressed Ctrl + C, the task will stop even you pressed N later.
Solution:
run npm install at your project folder and wait for it to be finished, then when you run ng -v again, the errors will gone.

npm init hangs while trying to use Grunt

I am trying to use Grunt to minify and compress my HTML, CSS and JavaScript files. However, I am hitting a roadblock with npm init. I have installed NodeJS and GruntCLI correctly. This is what I get when I enter the command npm init --verbose
is this ok? (yes)
npm info init written successfully
npm verb exit [ 0, true ]
and then it just hangs for hours. npm is stored in the path /c/Program Files/nodejs/npm. npm version is 2.15.5, NodeJS version is v4.4.5.
Any help will be greatly appreciated.
Thanks

Categories

Resources