Why can't find package required on the "npm" registry - javascript

I have problems running my web app using this tutorial video React Native Web Full App Tutorial - Build a Workout App for iOS, Android, and Web
in react-native. I've been searching a lot for an answer but there is no accurate one yet that solves my issue.
I downloaded the app from here: git repo.
Try to use:
$ yarn
$ yarn install
$ npm install
$ npm config set #icons:registry https://registry.npmjs.org/
$ rm -rf node_modules
$ npm i https://github.com/Qix-/node-error-ex
$ curl 'https://registry.yarnpkg.com/#types/node/-/node-9.4.2.tgz'
but nothing seems to work, I keep getting this error.
error Couldn't find package "#wow/common#1.0.0" required by "#wow/app#0.0.1" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "#wow/common#1.0.0" required by "react-native-web-workout-series#0.1.0" on the "npm" registry.
at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:721:66)
at new MessageError (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:750:123)
at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:36539:17)
at Generator.throw (<anonymous>)
at step (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:310:30)
at /usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:323:13
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Or any steps I need to follow to run this app. Since I want to download the app and edit the body content.

I tried to download and test it myself and it worked normally.
Clone it again and follow these steps:
#After cloning enter the folder
cd react-native-web-series
#install all dependencies
yarn install
#Navigate to the web folder
cd packages/web
#start the app
yarn start
Ps. : If a project is using yarn is not a good ideia to run npm commands, do not mix those two

In my case, the reason was the .npmrc file.
You can rename this file
mv ~/.npmrc ~/.npmrc2
npx create-react-app my-app
and rename it back after the installation.
mv ~/.npmrc2 ~/.npmrc

I ran into the same problem here.
And just as #Dmitry Grinko mentioned, it is related to .npmrc file.
I used private npm registry before so that some of package is missing.
Using following registry will pass the problem.
registry=https://registry.npmjs.org/

use npm login in terminal to login into your npm registry.
More information available here:
https://github.com/yarnpkg/yarn/issues/6029

npm install -g npm#latest
npm config set registry https://registry.npmjs.org/
If you're using nvm
nvm install 14.18.0
nvm use 14.18.0
nvm alias default 14.18.0

after look on the git repo - i think that maybe you should try to run npm i (or other commands - im not from react native area) in any package(app,common,web) to itself - like I saw any one of them has package.json of his own

Related

Cannot install Vue Cli on Mac Catalina [duplicate]

While installing the dependencies of vue-cli, vue is not identified. Why?
rm -rf node_modules and npm install again
have a look here
Add sudo before yarn when installing
yarn global remove #vue/cli
sudo yarn global add #vue/cli
vue
I had the same issue for a while.
TL;DR
npm install #vue/cli-service --save-dev
As the documentation specify it is a development dependency https://cli.vuejs.org/guide/#cli-service
The CLI Service (#vue/cli-service) is a development dependency. It's an npm package installed locally into every project created by #vue/cli.
Origin
I had a fresh install of nodejs
And just did
>> sudo npm install -g #vue/cli#latest
>> vue --version
#vue/cli 4.5.8
The issue
The issue presented like this
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
/bin/sh: 1: vue-cli-service: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The fixes:
npm install #vue/cli-service --save-dev
Which led me straight to another error message
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
ERROR Error: Cannot find module 'vue-template-compiler/package.json'
Which I fixed the same way
npm i vue-template-compiler --save-dev
And now it is working fine.
Installing current version without permanently installing vue-cli.
npx #vue/cli create appname
It shows the vue executable is located at /home/alisha/.local/bin. So probably this location is not there in your $PATH.
You should be able to run the vue commands if you provide the full path, like:
~/.local/bin/vue create hello-world
You can also see if that directory is in your PATH by running some command like:
echo $PATH | grep '.local/bin/'
If it's there, you would see it, otherwise you can add it to your path by placing it in your ~/.profile.
Edit ~/.profile and add the following at the bottom of it.
PATH="$HOME/.local/bin:$PATH"
Hope it helps!!
I had the same issue while making a build for production.
You will require vue-cli to be installed. Use below command to install the latest version.
npm install -g #vue/cli#latest
Then
npm install
Might have to do with you having an old version on your computer:
Warning regarding Previous Versions
The package name changed from vue-cli to #vue/cli. If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with
npm uninstall vue-cli -g or yarn global remove vue-cli.
You can find it here: https://cli.vuejs.org/guide/installation.html
THIS FIXED THE ISSUE FOR ME:
After running
sudo npm install -g #vue/cli
I ran
sudo nano $HOME/.profile
and pasted the following line
export PATH=$PATH:/home/chike/.npm-global/bin
after writing the code, next thing I did was Ctrl + O, ENTER and Ctrl + X then wrote
vue init webpack myapp
When you install vue using cli that time you got the path of vue.Now you can copy the bin folder path.
In my example /home/sublime/.npm-packages/bin
Now you export the path below command
export PATH=$PATH:/home/sublime/.npm-packages/bin
I solved mine by running (add sudo if needed)
npm i -g vue-cli#2.9.6
npm i -g #vue/cli
Got similar issue when deploy vue project in jenkins.
Here is what I did:
Add node's bin/ dir, to jenkins user's .bashrc file.
e.g
# node
NODE_HOME=/home/dev/.nvm/versions/node/default
PATH=$NODE_HOME/bin:$PATH
Tips - about nvm & yarn
When you manage node version via nvm, make sure you already choose the node version in terminal. e.g:
nvm use stable
node -v
If you use nvm, and installed yarn via npm, then better install vue-cli via npm not yarn, otherwise the vue executable is not placed into node's bin/ dir, at least that's the case in my tests, and as a result will cause you fail to find the vue command.
Using Yarn on Ubuntu it is installed to ~/.npm-packages/bin/. You must add this directory to your PATH. For example run the following command, close your terminal and open a new one.
user#machine:~$ echo 'export PATH="$PATH:~/.npm-packages/bin/"' >> ~/.bashrc
Note: if the file ~/.bashrc does not exist then simply create it.
Following worked for me:
First remove all the existing ones:
yarn global remove #vue/cli
yarn global remove #vue/cli-service
sudo yarn global remove #vue/cli
sudo yarn global remove #vue/cli-service
Then add #vue/cli using sudo:
Note: use sudo if required
yarn global add #vue/cli
yarn global add #vue/cli-service
Then, the final thing to do is to RESTART the terminal.
vue --version
#vue/cli 4.5.9
If you already got a project, the only two things you need to do is:
Delete the directory node_modules (it is safe, since it is not under git and will regenerate in the next step)
In the command-line write yarn install (it will install everything you need)
If you start installing vue-cli manually in a existing project, it the package.json and package-lock.json will be updated. If you already did. Do a checkout from git, and follow my steps above
This may be a problem caused by version conflicts. "export PATH=$PATH:" This is really useful in some cases. But if you are also like me, after trying the direct “export path” method in the comment above, restarting the terminal still can not execute the situation, you can try this way.
Uninstall Vue
npm uninstall -g #vue/cli
Check the local-global npm package installation path, vue is installed in this directory, check if it has been removed.
npm root -g
Install vue (you can check with https://cli.vuejs.org/#getting-started to find the latest command)
npm install -g #vue/cli
Create a connection to the /usr/local/bin directory(You need to find the vue.js path after the local installation first, then replace this path with your latest local install path:/Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js)
ln -s /Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js /usr/local/bin/vue
View version number
vue -v
I was getting the same error because Node.js was not installed. My issue got resolved by installing Node.js using the following command:
sudo apt install nodejs-legacy
To see if you already have Node.js and npm installed and check the installed version, run the following commands:
node -v
npm -v
If both are installed then follow the steps here:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
I installed the package using yarn global add #vue/cli on my Ubuntu box and found the binary in /home/vonkad/.yarn/bin.
I had to modify my /home/vonkad/.bashrc and add the directory to the path export PATH=$PATH:/home/vonkad/.yarn/bin.
To fix this situation, I had to add the following line to my .zshrc (maybe in your case is .bashrc)
export PATH="$(yarn global bin):$PATH"
Effectively, the yarn global bin is a folder where vue (vue-cli 3) was placed.
What helped me
mac os catalina with zsh terminal
Uninstalled node and npm using https://www.positronx.io/how-to-uninstall-node-js-and-npm-from-macos/
Downloaded node/npm from https://nodejs.org/en/download/current/
sudo npm install -g #vue/cli
vue --version (#vue/cli 4.5.4)
I faced the same issue and now resolved. In my case I installed Node.js and NPM using the default Ubuntu repository by using this command sudo apt-get install nodejs npm
The problems seemed like those 2 packages are not well maintained so it caused some bugs.
So I purge those packages and reinstall it from nodesource which is officially recommended way to install (reference: Installation instruction from nodesource) using these commands.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Then reinstall #vue/cli again
sudo npm install -g #vue/cli
Now these issues have gone. Hope it helps some programmers.
You need to install vue via sudo like explained in the doc:
https://cli.vuejs.org/guide/installation.html
If you have WSL2 running and you use zsh like me, just add
yarn global add #vue/cli
# add this line to ~/.zshrc
export PATH="$HOME/.yarn/bin:$PATH"
$ vue --version
#vue/cli 4.x.xx
You can try the following code install see
npm install --global vue-cli
vue init webpack <YOUR-PROJECT-NAME-HERE>
cd <YOUR-PROJECT-NAME-HERE>
npm install
npm run dev

Yarn install not working, getting "Other managers are not allowed"

I just started using yarn package manager in one of my project. I installed yarn globally using sudo npm install yarn -g
But when I tried to install dependencies using yarn install I was getting the following on the CLI
info No lockfile found.
$ node tools/preinstall
=========================================
Please install / add dependencies via npm
Other managers are not allowed
=========================================
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
That's weird. Any idea why am I getting this? Is there anyway I can enable yarn for my project?
Thanks in anticipation
Looks like it was happening because of preinstall script. Thanks #Kevin for the answer, you saved my day.

Failed to create app with create-react-app in Linux 16.04

I am trying to create new app with create-react-app.
Below is the error.
Please help. Thanks in advance
➜ REACT create-react-app my-app
Creating a new React app in /media/budi/Tjung/#TJUNG/REACT/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.6.0
info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occurred: "http://registry.npmjs.org/react: > ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/media/budi/Tjung/#TJUNG/REACT/my-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /media/budi/Tjung/#TJUNG/REACT/my-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting my-app / from /media/budi/Tjung/#TJUNG/REACT
Done.
error image at CLI
Looks like network problem to me. You could be behind a proxy. If that is the case, configure your proxy in npm like this
npm config set proxy http://proxy_host:port
For https
npm config set https-proxy http://proxy.company.com:8080
Note: The https-proxy doesn't have https as the protocol, but http.
Optionally you can also try,
npm config set strict-ssl false
Checkout this SO answer
check if npm exists on your system.
try the commands in this order.
1. npm install --save create-react-app
2. create-react-app projectname
The name of the project must be in lowercase
Assuming that you have Node installed, you can use npm to install the create-react-native-app command line utility:
npm install -g create-react-native-app
Then run the following commands to create a new React Native project called "my-app":
create-react-native-app my-app
cd my-app
npm start
I have solve this problem.. it is about internet speed connection.
.
When I met this problem, I have spent one day to find out the solution. I read so many article about ETIMEDOUT. I had uninstall and re-install npm and yarn. Still doesn't solve my problem.
.
Until then I found the spot that has high speed internet connection. Fortunately I can create new app with create-react-app.
I think there are problem with your configurations of npm package.
Maybe somewhere, you set up some proxy configuration to npm variables.
You can reset configs running this script in terminal
sudo sh -c 'echo "" > $(npm config get globalconfig)'
and wait until process will end and run
exit
Open another terminal window and try

yo meanjs:vertical-module runs the application creator

I have been using mean.js version 0.3 with no problems up untill now. Today I decided to checkout mean.js 0.4 so I ran
npm install -g generator-meanjs
to install the new version of the generator, and then ran
yo meanjs
and I went through the steps of the generator which finished successfully, and I was able to run the example site.
However, when I tried to use yo to create my own modules with the following command:
yo meanjs:vertical-module customer
It runs the application setup again:
You're using the official MEAN.JS generator.
? What mean.js version would you like to generate? (Use arrow keys)
master
❯ 0.4.0
0.4.1
I tried looking for a solution, and the only thing I found was this issue:
https://github.com/meanjs/generator-meanjs/issues/79
That suggested the cause is multiple versions of the generator is installed, so I tried uninstalling with the following command and then re-installing by repeating steps I described above
npm unstall -g generator-meanjs
But I am still getting the same results
I would really appreciate any suggestions as to how resolve this. TIA!
I had the same problem, finally figured it out. Maybe it will work for you too:
# remove meanjs generator from npm global
sudo npm remove generator-meanjs -g
sudo npm cache clean -g
# figure out where my npm global modules are
npm root -g
Result: /usr/local/lib/node_modules
# cd to the npm global directory
cd /usr/local/lib/node_modules
# get the latest Yo generator code from GitHub
sudo git clone https://github.com/meanjs/generator-meanjs
# switch to the 0.4-dev branch
cd generator-meanjs
sudo git checkout origin/0.4-dev
#install (run while in generator-meanjs dir)
sudo npm install
# test it
cd ~/
mkdir tmp
cd tmp
yo meanjs:vertical-module my_crud_module
try to install the following version of meanjs generator
npm install -g meanjs/generator-meanjs#0.4-dev
then use
yo meanjs:vertical-module customer
i think that will help.
After hours of haunting errors I managed to find a way to generate crud module. As you guys know 0.4.x generators are still under development so there's a way to create another meanjs project folder with 0.3 version. You can downgrade to meanjs 0.3x without destroying the meanjs 0.4 project folder. All you have to do is to downgrade generator-meanjs to 0.1.12 version and downgrade yo to 1.3.3 or the versions till january 2015.
You can find the information about versions through:
sudo npm info -g yo
sudo npm info -g generator-meanjs
I came up with a hack to fix this issue:
1. Install the crud module when creating your meanjs application:
yo meanjs
this will install an articles crud module in the modules directory.
2. Replace all keywords article by name in all files.
3. Rename all filename with name instead of 'article' in the articles directory.
I have posted a video where I explain these steps in details:
https://www.youtube.com/watch?v=Nkpdp1ofux8

Express module not found when installed with NPM

When I try to run the app.js file created by express, I get the following error:
$ node app.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'express'
at Function._resolveFilename (module.js:320:11)
When I type in express --version I get a return statement of 2.3.3. I used npm to install express. I had to manually make npm using these instructions:
git clone http://github.com/isaacs/npm.git
cd npm
sudo make install
The error is Error: Cannot find module 'express'.
Do I need to do something after installing npm and express in order to make express see the modules created by npm?
My node is version: 0.4.6
My express is version: 2.3.3
My npm is version: 1.0.6
Express is installed globally. I used the -g flag to install it.
Edit: When I try "node -e require.paths" I get:
[ '/home/user/.node_modules',
'/home/user/.node_libraries',
'/usr/local/lib/node' ]
So, node isn't detecting the npm installation. How do I get node to detect the npm installation?
Install express
npm install -g express
Create a new app
express your_app
cd into app directory
cd your_app
use npm link to resolve modules
npm link express
Use local installs for require(), and global installs for command-line apps.
If you need both, use the npm link command.
On Ubuntu 12.04 you have to add the export NODE_PATH=/usr/local/lib/node_modules to your /.bashrc to use globally installed modules.
It appears that while npm had been updated to install global modules into /usr/local/lib/node_modules, Node's own require.paths does not yet reflect this change.
There are two reasonable solutions:
Add the following code to the top of your application:
require.paths.push('/usr/local/lib/node_modules');
Pro: non-invasive, easy to add
Con: requires discipline, future versions of node will restrict access to require.paths
As root, execute:
ln -s /usr/local/lib/node_modules /usr/local/lib/node
Pro: reasonably non-invasive
Con: requires root, modifies linux fs, might not survive system updates
I had the same problem. This worked for me though:
Seems like npm (now?) installs node modules to /usr/local/lib/node_modules/ and not /usr/local/lib/node/
What I did was simply to copy everything from node_modules to node: sudo cp -r /usr/local/lib/node_modules/* usr/local/lib/node/ and now it seems to be working for me.
Hope this helps you :-)
What about NODE_PATH=/usr/local/lib/node_modules in .bashrc or .bash_profile? I think it's the real correct way.
Set NODE_PATH=NODE_HOME\node_modules.
I'm using windows 7 and it works fine.
It may happen, if you're using windows, that the environment variable NODE_PATH is not set, and thus when you execute node fileName.js it won't find the libraries.
Check for the variable on your console, and if not present, create it. Give it the NODE_HOME\node_modules value, where NODE_HOME is your node install dir. This path is where npm install puts every module upon downloading.
require.paths is removed, use the NODE_PATH environment variable instead.
It looks like the easiest way to do this is to run npm install from your app's folder. This tells npm to hook everything up.
It's the last instruction after express <appname>:
...
dont forget to install dependencies:
$ cd <appname> && npm install
Finally with Linux a good way to do is to use the command : sudo apt-get install node-express
But with express 4 we must use express-generator to make app skeleton, install it with 'npm install express-generator -g', and then run 'express myapp' command.
see also install express
for mac users
cd /usr/local/lib/node
sudo ln -s ../node_modules/* ./$1
I installed gulp and when I ran this gulp command in the command line I got a gulp: command not found error. It appeared that it installed gulp in my local folder that is /home/YOURUSERNAME/.node/lib/node_modules and not in the global npm folder.
You can check npm root folder by running this command: npm root -g, which was returning my personal directory /home/YOURUSERNAME/.node/lib/node_modules and not the expected /usr/local/lib/node_modules.
You can fix this by running npm config set prefix /usr/local command.
For all problems with express with a mac computer:
The solution is:
chown to your user the .npm folder :
sudo chown -R Webmaste /Users/webmaste/.npm/
At your test folder or your folder:
sudo npm install -g express#2.5.8
Invoke express from your actual location:
/usr/local/share/npm/bin/express
sudo cd . && npm install
Finally:
node app
the final message in the console should look like this:
Express server listening on port 3000 in development mode

Categories

Resources