Can't create a new project in Ionic 4 - ionic4

I need help with Ionic4.
I am trying to create a new project but I am getting this error:
npm i npm WARN deprecated istanbul#0.4.5: This module is no longer
maintained, try this instead: npm WARN deprecated npm i nyc npm WARN
deprecated Visit https://istanbul.js.org/integrations for other
alternatives. npm WARN deprecated circular-json#0.5.9: CircularJSON is
in maintenance only, flatted is its successor. npm ERR! Unexpected end
of JSON input while parsing near '...v/7+T+UmfF7FFAzvKrLbt'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\SAMSUNG\AppData\Roaming\npm-cache_logs\2019-02-18T15_07_32_601Z-debug.log
[ERROR] An error occurred while running subprocess npm.

Since OP didn't update with his solution, based on the original post I'm guessing he had an older version of NPM. This is a problem on Ubuntu because at least as of my posting this the standard one you get by running "apt install npm" is like version 5. To install NPM 10.x+, do this:
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs
I found this solution here (not affiliate or anything):
https://joshtronic.com/2018/05/08/how-to-install-nodejs-10-on-ubuntu-1804-lts/

Related

Error while installing vue CLI: npm ERR! Unexpected end of JSON input while parsing near '...ulp-rename":"0.0.33",'

I had an older version of vue CLI and i want to upgrade to CLI 3, so first what I did is unistall the previous version:
npm uninstall vue-cli -g
Then tried to install:
npm install -g #vue/cli
I got the following error:
npm ERR! Unexpected end of JSON input while parsing near '...ulp-rename":"0.0.33",'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\31089\AppData\Roaming\npm-cache\_logs\2020-02-02T11_48_31_187Z-debug.log
The complete log information can be found here
My node version: v12.14.0
My npm version: 6.13.4
And I tried
npm cache clean --force
but didn't work.
I figured out, if you run command prompt window as an administrator, then first do
npm cache clean --force
then can install successfully.

npm ERR! 404 Not Found: pinkie-promise

I'm trying to install Ionic Pro, and I am getting this error while pushing through live deploy..
Any help would be gladly appreciated
npm install --quiet --no-optional
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pinkie#2.0.4 (node_modules/pinkie):
npm WARN 404 SKIPPING OPTIONAL DEPENDENCY: Not Found: pinkie#https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz
npm ERR! code E404
npm ERR! 404 Not Found: pinkie-promise#https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gitlab-runner/.npm/_logs/2018-01-06T18_55_47_426Z-debug.log
npm install --quiet --no-optional failed
Running after script...
$ run "clean-up"
Running Stage clean-up for Job: 5211838
ERROR: Job failed: exit status 1
A little under a year ago, the package "leftpad" broke NPM builds all over the world because the author pulled it from the public repository.
The same is happening today, for "pinkie-promise". The author's NPM account (#floatdrop) was deleted, opening opportunities for malware in all the packages he's written.
Dependent builds include Ionic and (in my case) node-sass.
Resources:
NPM issue: https://github.com/npm/registry/issues/255
Incident report: https://status.npmjs.org/incidents/41zfb8qpvrdj
pinkie-promise issue: https://github.com/floatdrop/pinkie-promise/issues/4
Dependent packages: https://www.npmjs.com/browse/depended/pinkie-promise
All of #floatdrop's repositories: https://github.com/floatdrop?tab=repositories
I was able to work around this by installing pinkie-promise by pointing to their github repo.
npm install https://github.com/floatdrop/pinkie-promise.git
Solution to make project build work again
Since this dependency is not available on npm registry,
one will have to do the following to make it work.
Follow these steps to make things work again.
rm -rf node_modules/
rm -rf package-lock.json
npm i https://github.com/floatdrop/pinkie-promise.git
In the end you will see the output
+ pinkie-promise#2.0.1

Can't install "react native cli" globally by using git bash

When I type in "npm install -g react-native-cli" at git bash I get following errors:
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at: npm ERR! https://github.com/npm/npm/issues
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\TOSHIBA İ5\AppData\Roaming\npm-cache_logs\2017-10-19T04_04_05_774Z-debug.log
I have already installed npm and added it's directory to PATH variable and when i type "which npm" at git bash it shows the directory so there is no problem about the installation of npm. But it still gives these errors and I am stuck.
Note: I am following the instructions on https://shift.infinite.red/getting-started-with-react-native-development-on-windows-90d85a72ae65
This could happen in some npm old versions. Make sure you are using an updated one.
npm install -g npm
Some linux distros have old versions of npm and node on their packages and you need to install it manually.
Edit: I just saw you have windows. Nevermind, still the old version could be a problem.

Yeoman won't install because of 406 for 0.9.5.tar.gz

I tried npm install yeoman in linux mint 17 today and get the following error:
npm http 406 http://github.com/yeoman/generators/archive/0.9.5.tar.gz
npm ERR! fetch failed http://github.com/yeoman/generators/archive/0.9.5.tar.gz
npm ERR! Error: 406 Not Acceptable
npm ERR! etc
It was working last time I installed a few weeks ago. This is a deal breaker for me today as I need this package.
My npm version is 1.3.10
Any ideas?
I was able to fix this today. Previously, I believe that Yeoman was installed with npm install -g yeoman. Apparently, that has been deprecated. I was able to successfully install yeoman with npm 1.4.28 and node 0.10.32 by running sudo npm install -g yo. I found the answer by taking a look at their homepage again: http://yeoman.io/.

npm install -g yo command gives -> ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`

I just tried to do a npm install but get this error about doctor,js at the end. Do I need to worry about it?
npm install -g yo
.
.
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/fstream/-/fstream-0.1.25.tgz
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js
> yo#1.1.0 postinstall /usr/local/lib/node_modules/yo
> node scripts/doctor.js
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`
npm ERR! `sh "-c" "node scripts/doctor.js"` failed with 1
npm ERR!
npm ERR! Failed at the yo#1.1.0 postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/doctor.js
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /etc/libvirt/qemu
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /etc/libvirt/qemu/npm-debug.log
npm ERR! not ok code 0
EDIT____________--
for some reason node -v outputs nothing in terminal
I have the latest node installed:
WebstormProjects # sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
node is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
The solution at this link has worked for me:
http://plaidzooks.tumblr.com/post/36894116867/using-node-js-on-debian-ubuntu-systems
Ubuntu comes with a package that automatically creates a link so the command 'nodejs' can be invoked as 'node' only by creating a link.
sudo apt-get install nodejs-legacy
And that got Yeoman working.
Likewise I had this same problem (albeit on a Mac). I uninstalled and upgraded node to the latest version (v0.10.24) but without success.
The symlink fix did work for me, although with a slight tweak:
sudo ln -s /usr/local/bin/node /usr/bin/node
I believe this may be due to the way which node was installed on your system. Apparently, sometimes when installing Node via a package manager, the linked binary is nodejs, (thus nodejs _command_ is the command that works on your machine, not the much more common node _comamand_. You can either re-install Node (the latest version is now 0.10.24) from nodejs.org, or try this solution from this related issue:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
You have to install nodejs in this way:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
I had this same error on a clean Ubuntu 13.10 install and no amount of sym linking (node > nodejs) or installing/uninstalling helped me.
I don't have a deep enough understanding of the node environment to troubleshoot it properly but I was able to install Yeoman globally by cloning the repo and removing the postinstall check from package.json.
If anyone else want's to try this solution:
Clone Yeoman..
cd ~
git clone https://github.com/yeoman/yo
Edit the package.json..
nano yo/package.json
.. to remove these lines..
"scripts": {
"test": "grunt",
"postinstall": "node ./scripts/doctor",
"postupdate": "node ./scripts/doctor"
},
Then, install it using npm..
cd yo
npm install -g
If you want to clean up you can remove the Yeoman repo..
cd ..
rm -R yo/
Obviously your mileage may vary but it's working fine for me so far.
I also noticed I was able to successfully run the doctor.js script independent of the installation process. No idea why it was failing so hard in the first place..
On Ubuntu 14.04, I tried both installing the legacy package (per Antonio's answer) and creating the symlink manually (per Stephen's answer). Neither worked. The Ubuntu package has version 0.10.25 of node.js, but Yeoman seems to require a newer version.
After installing the latest version of node.js from NodeSource (currently v6.9.1), I was able to install Yeoman using npm install -g yo .
To solve this problem you need to install the package nodejs-legacy.
sudo apt-get install nodejs-legacy