'npm start' kicks off loop to install expo-cli - react-native

QUESTION: How can I make it so $ echo $PATH returns export PATH=~/.npm-global/bin:$PATH
BACKSTORY:
I did an npm install on terminal (macOS Catalina) and started
to get into a loop about installing expo cli when trying to npm
start. I've since followed instructions here:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
had to execute step 5 (from link above) as source ~/.bash_profile
Tried npm start but still running into the loop
Already have npm 6.13.4 installed. However, running npm start results in below. Notice how it says Expo CLI installed but asked to install globally again so the 2nd time I say n:
(base) MacBook-Pro:rn-starter user$ npm start
> # start /Users/user/Desktop/REACT NATIVE/rn-starter
> expo start
This command requires Expo CLI.
Do you want to install it globally [Y/n]? Y
Installing the package 'expo-cli'...
Expo CLI installed. You can run `expo --help` for instructions.
This command requires Expo CLI.
Do you want to install it globally [Y/n]? n
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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! /Users/user/.npm/_logs/2020-04-03T14_39_24_884Z-debug.log
Here's what's on line 8 of the log file:
8 verbose lifecycle #~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/user/Desktop/REACT NATIVE/rn-starter/node_modules/.bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/git/bin
I've previously installed Anaconda (several months back) and have uninstalled it using https://docs.anaconda.com/anaconda/install/uninstall/ However, running $ echo $PATH results in
/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/git/bin
QUESTION: How can I make it so $ echo $PATH returns export PATH=~/.npm-global/bin:$PATH
Appreciate any suggestions that can help!

How is your package.json file?
Your npm start must is calling the expo

Related

npm ERR! code ENOTEMPTY npm ERR! syscall rename

when I try to initialize a react-native project I am getting this error. Anyone know how to resolve this please help
i am using mac
Need to install the following packages:
react-native
Ok to proceed? (y) y
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native
npm ERR! dest /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/codelanticdeveloper/.npm/_logs/2022-02-16T15_54_46_715Z-debug-0.log
where it says...
directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
delete the file after the arrow and try again
rm -rf '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
Try deleting all the files in the node modules that end with a similar names, like '*-QIQKGFeg'
I did it manually and it worked for me
I also had this problem and fixed it by:
Deleting the problematic Expo files here per the instructions here I'm trying to reinstall expo-cli package globally with the command sudo npm install --g expo-cli note that I try --force
In the terminal, running nvm install 16.14.0 (this will download the correct Node.js LTS release that is required by Expo)
In the terminal, running brew install watchman (this is required by Expo)
In the terminal, running npm install --global expo-cli (globally downloading Expo again)
In the terminal, running expo init my-app to finally create the new app successfully!

Create React App install in Mac says MODULE_NOT_FOUND

I was trying to install Create React App using npm install -g create-react-app . The installation runs well without problem. There was an error that popped up when I entered npm start which is similar to snapshot below. I am using macOS High Sierra version 10.13.x and npm version 13.6.4.
Even though it says "Successfully created my-app", cd my-app and then npm start running the command in console shows following lines of errors that goes like,MODULE_NOT_FOUND.
Do anyone knows that version of npm has a issue installing create react app in Mac, please help.
i.e. >
internal/modules/cjs/loader.js:628
throw e;
^
Error: No valid exports main found for '/Users/Nirmala1/React/my-app/node_modules/postcss-safe-parser/node_modules/postcss'
at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
at applyExports (internal/modules/cjs/loader.js:502:14)
at resolveExports (internal/modules/cjs/loader.js:551:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/Nirmala1/React/my-app/node_modules/postcss-safe-parser/lib/safe-parse.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1144:30) {
code: 'MODULE_NOT_FOUND'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#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:
Fixed this problem by upgrading node.js to v14.5, i've had v13.5 and v13.6 before on my Mac.Tried to solve by removing create-react-app globally:
npm uninstall -g create-react-app
and using:
npx create-react-app myapp
But it didn't work for me. I installed latest version of node using curl -o- url command to download, like
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
and to install using nvm install version. nvm install v14.15.1
and npx create-react-app myapp
worked well by loading create react app page in http://localhost:3000/.
I came across the same issue with code: 'MODULE_NOT_FOUND' on Ubuntu. I was using an older version of node at the time. All I had to do was to upgrade to the latest version by using the Node Version Manager nvm
Type in the command line:
nvm install stable
That should get you the latest version and then go back to your react app and do as before npm start.

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 start command with webpack on Windows 10 fails

I am currently using node to build a website. I have run the webpack dev server fine in ubuntu but in windows i cant seem to get the npm start command to work
I am able to npm run build-sw on both platforms without error but just not able to run.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! site#1.0.0 start: `npm run build-sw && ./node_modules/.bin/webpack-dev-server --progress --host 0.0.0.0 --no-info --watch-poll`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the site#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This
I finally was able to get the project running using YARN.
It needed no configuration change.
I had to install Visual C++ but after that
yarn and yarn run start did the trick.
So on ubuntu I use npm but on windows i use yarn. Works now

Why does Fabric Composer npm-install fail for my Ubuntu setup?

I'm a newbie to npm and hyperledger fabric-composer
Question: What is the problem with my setup? What is the strategy to investigate and solve such errors?
What I did:
Setup Ubuntu Linux 14.04 LTS (64-bit)
Installing prerequisites using the script provided on
https://fabric-composer.github.io/tasks/prerequisites.html
Executing npm install causes (don't know if this info is sufficient):
[...]
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/home/mjh/.nvm/versions/node/v4.6.2/bin/node" "/home/mjh/.nvm/versions/node/v4.6.2/bin/npm" "install"
npm ERR! node v4.6.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! getting-started#1.0.0 install: `scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the getting-started#1.0.0 install script 'scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls getting-started
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/mjh/sample-applications/packages/getting-started/npm-debug.log
See link for detailed npm-debug.log file
https://gist.github.com/mjh-halder/9fe473b44f0a731c996bbc5754011013
I've seen this problem before on trusty (14.04) and relates to an out of date urllib3 library for python, which is used by docker compose.
depending on which version of pip you have installed you can update the urllib library as follows
pip install --upgrade pip
pip install -U urllib3
You are missing permissions, so you need to do sudo npm-install ...
The issue here is related to the last part of the installation script - this is the part that installs the docker-compose tool. Testing this today on a clean Ubuntu 14.04 LTS image, that was the cause.
I'd recommend installing docker-compose following the instructions on the docker site. (https://docs.docker.com/compose/install/)
In effect this is
curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o
chmod +x /usr/local/bin/docker-compose
Run the docker-compose --version to check it's installed correctly
$ docker-compose --version
docker-compose version: 1.10.0
Then run the rest of the Fabric Composer scripts as before.
We're updating the script - but this should get you going.