IBM MFP cli install failure: npm install -g mfpdev-cli - mobile

When I attempt to install the IBM Mobile First CLI (mfpdev-cli), I'm getting an error.
Command:
npm install -g mfpdev-cli
Error details:
npm ERR! path /Users/timothy/dev/project/mdo-windows-support/package.json
npm ERR! code ENOPACKAGEJSON
...
npm ERR! package.json npm can't find a package.json file in your current directory.
It looks like it's trying to create an npm named 'mdo-windows-support' locally, but it fails. Any suggestions?
npm version: 5.0.1
node version: v8.0.0

Okay, it turns out that the versions of npm/node were the culprit. I switched back to the LTS version of Node, and it worked.

Related

How can i solve NPM err when i get the npm ERR! code E404

I have just created a new laravel application to implement a chat app.
I wanted to scallfold the application using bootstrap but am getting this error :
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/33998 - Not found
npm ERR! 404
npm ERR! 404 '33998#*' is not in this registry.
npm ERR! 404
How can i solve it?
I tried running composer update to see if im missing some dependencies.
I was wrong.
I also runnpm install && npm run devit still did not work
Try to run these commands:
npm config set registry http://registry.npmjs.org
npm -g install npm
npm cache clean -f
After that try to run your project with:
npm run dev
This error is just because of the package 33998 could not be found in the npm registry.
For solution you need to install bootstrap package in your application manually.
For installing BootStrap Use
npm install bootstrap
Also clean the cache of npm forcefully by
npm cache clean --force
Also check the latest npm version and update it if it was to old.
npm -v
npm install -g npm

npm ERR! cb.apply is not a function (Windows)

I'm having this problem when trying to install React, can anyone please help me?
C:\Users\MyName>npm install react --save
npm WARN npm npm does not support Node.js v16.13.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mikok\AppData\Roaming\npm-cache\_logs\2022-01-08T13_47_27_192Z-debug.log
Uninstall NPM and install the latest version of Node. The current version, not LTS on the website.
Go to C:\Users\UserName\AppData\Roaming and delete the "npm" and "npm cache" folders.
On your command prompt, run "npm cache clean --force".
Then run "npx create-react-app#latest your-app-name" or "npx create-next-app#latest your-app-name" depending on you preference.
npm uninstall -g npm
or
Uninstall Node from your program files.

react-native installing react-native-gesture-handler just hands and doesn't install

I am trying to install react-navigation so I can add navigation to my react app. I am following the instructions on https://facebook.github.io/react-native/docs/navigation but I can not get it to all install properly.
I am on a windows machine and have react versions
"react": "16.9.0",
"react-native": "0.61.5",
I installed react-native
npm install -g react-native
I installed the cli
npm install -g --save react-native-cli
I created my app
react-native init MyReactNativeApp
I cd'ed into that folder
cd MyReactNativeApp
I installed react-navigation
npm install -g --save react-navigation
npm install #react-navigation/native #react-navigation/stack
I am trying to run the next step which is the following, however it just hangs
If you have an bare React Native project, install the dependencies with npm:
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
Further investigations shows i can install all the following all ok
npm install react-native-reanimated
npm install react-native-screens
npm install react-native-safe-area-context
npm install #react-native-community/masked-view
Its the install of "react-native-gesture-handler" which just hangs, i do not get any error message
npm --save install react-native-gesture-handler
[..................] - loadDep:prop-types: sill resolveWithNewModule react-native-gesture-handler#1.5.6 checking installable status
I have searched the net and tried a number of things, such as those below but nothing works
run my command window as an administrator
removed the react-native-safe-area-view folder from node-modules and tried again
put my GIT home on my PATH
I believe without this i can not use react-navigation and my app fails to run.
I do not understand why this is not working when i am following the official documentation.
UPDATE
Eventually it failed (after about 10 mins) with
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t
https://github.com/naver/hammer.js.git
npm ERR!
npm ERR! undefined
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MYUSER\AppData\Roaming\npm-cache\_logs\2020-02-
12T13_26_03_301Z-debug.log
The log file contents do not say anything more than the error
43 error Error while executing:
43 error C:\Program Files\Git\cmd\git.EXE ls-remote -h -t
https://github.com/naver/hammer.js.git
43 error
43 error undefined
43 error exited with error code: 128
GIT on my machine
>which git
C:\Program Files\Git\cmd\git.EXE
>git --version
git version 2.21.0.windows.1
Confirm you have git installer and available in command line
Since you are using rn 61, you should initialize your project with npx
npx react-native init AwesomeProject
The error implied that GIT can not access the given site. I'm behind a corporate Firewall. I set a proxy in git and I can now install "react-native-gesture-handler"
git config --global http.proxy http://host:port

NPM error E404 when try to start create-react-app and installing react-dev-utils

I got error when run command create-react-app react-app...
npm ERR! code E404
npm ERR! 404 Not Found: react-dev-utils#https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-5.0.2.tgz
node version: 8.11.4
npm version: 5.6.0
please help
Try to install below first globally and the run the react create cmd
step 1: npm install -g react-dev-utils#https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz
step 2: npx create-react-app my-app
your application will up and running.
(remove the "/-/" from the URL) and run the command below
npm install -g react-dev-utils#https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz
Then try to run again
create-react-app react-app
on windows os, uninstall node completely then install the latest one again. I solved my issue like that and works like a charm..

"sh: 1: react-scripts: not found" In Docker

I have a Docker container that fails to do a npm install for a react.js app that is cloned in the container when it is built. Would anybody know how to resolve the issue?
Error:
sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! myrideweb#0.1.0 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the myrideweb#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-06-19T04_00_09_065Z-debug.log
Dockerfile:
FROM ubuntu
Run apt-get update
Run apt-get install curl -y
Run curl -sL https://deb.nodesource.com/setup_10.x
Run apt-get install -y nodejs
Run apt-get install -y git
Run apt-get install npm -y
Run apt-get update -y
Run git clone https://github.com/sdrafahl/TerraWeb.git
WORKDIR /TerraWeb
Run npm install -g --save npm#latest
...
I have a similar issue and I managed to work around by changing:
"start: "react-scripts start"
to:
"start: "./node_modules/.bin/react-scripts start"
in the scripts section package.json.
I use the classic node base image but it should work more or less the same.
And I am still investigating why NPM is not able to resolve react-scripts when running inside Docker, any further help is very welcome :-)
This happened to me when 'react-scripts' was listed under the 'devDependencies' in the package.json file. Moving it to the "dependencies" section solved the issue.
Deleting package-lock.json and re-installing packages with npm install before building the container solved the issue for me.
I had this issue with react-scripts#4.0.1. I uninstalled and re-installed and that seemed to do the trick.
npm uninstall react-scripts
npm install -D react-scripts
Ok, I just managed to solve this problem in few simple steps, and i hope these instructions will help you too.
I run a docker with Ubuntu on Windows 10, and I share the node_modules folder by volume if this sounds familiar to you, so I believe this solution will help you.
Accidentally I installed the node modules from my Windows user, and that what cause the whole permissions problems.
So what I did is to delete the node_modules directory.
Then I installed the node modules from the Ubuntu Terminal, run npm install.
You may have to install npm on your Ubuntu, I downloaded the nvm installation file with curl with those instructions, How to install node on WSL for Linux, and then you may run npm install and then the react script will be able to run.
After you run npm install from Ubuntu, build and run your dockers.
I had this same problem recently and I was able to solve it, however, I don't like the solution very much but I think it's OK since it should run in Docker or in you local machine. That being said, my suggestion is to update the package.json with the following:
{
"scripts": {
"start": "$(npm bin)/react-scripts start",
}
}
npm-bin docs

Resources