New to React Native I've made sure to install node.js from here and after install I'm told:
Node.js v9.5.0 to /usr/local/bin/node
npm v5.6.0 to /usr/local/bin/npm
I can verify the node version:
node --version: v9.5.0
I ran the documentation's getting started for npm install:
npm install -g create-react-native-app
and also referenced building projects and installed watchman with brew:
watchman 4.9.0
in the terminal ran: npm install -g react-native-cli and terminal: npm start and I get:
grim ~/react-native/react-native npm start
> react-native#1000.0.0 start /Users/grim/React-Native/react-native
> /usr/bin/env bash -c './scripts/packager.sh "$#" || true' --
module.js:557
throw err;
^
Error: Cannot find module 'graceful-fs'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/grim/React-Native/react-native/local-cli/cli.js:12:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
grim ~/react-native/react-native
After research I found NPM, cannot find 'graceful-fs', no matter what I do and in terminal ran:
sudo npm install -g graceful-fs
and get:
+ graceful-fs#4.1.11
added 1 package in 0.678s
but when I run npm install I get:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/grim/.npm/_logs/2018-02-08T17_08_50_619Z-debug.log
and in the file log it shows:
116 error code EUNSUPPORTEDPROTOCOL
117 error Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
so I went to The Problem with gulp-util but when I do:
npm ls gulp-util
I get └── (empty).
Further research I found Why is my npm install not working? but that throws an npm ERR! What am I doing wrong and how can I get npm successfully installed on my Mac running Seirra?
What caused this was trying to test RNTester from the react native repo and it told me:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Edit
Per the suggested answer already tried brew install node and was told with a warning node 9.5.0 is already installed so tried brew link node then prompted:
grim ~/react-native/react-native brew link node
Linking /usr/local/Cellar/node/9.5.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
so ran brew link --overwrite node.
Edit
Browsing through my files under Users/grim I found a directory with modules in it named node_modules could that be in the wrong location?
Edit
After further research I found Fixing npm On Mac OS X for Homebrew Users and ran:
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
modified my ~/.bash_profile with nano:
export PATH="$HOME/.npm-packages/bin:$PATH"
ran npm install and received a missing package.json file so in the terminal did npm init and answered the questions. Went back and pointed to the cloned repo and when I run npm install:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
but if I build a new project with react-native init AwesomeProject and npm install I get:
up to date in 0.416s
and I can point into the project and do react-native run-ios and it works but react-native run-android has to be tweaked in the build.bundle from: classpath 'com.android.tools.build:gradle:2.2.3' to classpath "com.android.tools.build:gradle:2.1.0"
Use Homebrew for Mac as package manager;
https://brew.sh/
then you can run: brew install node
There are many other utilities on this.
create-react-native app does not work with npm 5.
I had the same problem on Windows and downgraded my npm to 4 you can use npm i -g npm#4 to downgrade.
You may try to use yarn command with -W flag (or --ignore-workspace-root-check) which might be helpful.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Regards
Related
For reasons unknown to me, I haven't been able to update to the latest version of npm on macOS (it works fine on Windows). It displays no error, only 'updated 1 package'.
Using Node.js 8.11.1
node -v
v8.11.1
What version of npm do I have?
$ npm -v
5.6.0
I tried this...
$ npm i -g npm
+ npm#5.8.0
updated 1 package in 7.37s
And it fails to update.
$ npm -v
5.6.0
Where is npm?
$ which npm
/usr/local/bin/npm
So I try brew...
brew install npm
And it fails...
$ npm -v
5.6.0
*And then I tried this... *
npm install npm#latest -g
+ npm#5.8.0
updated 1 package in 7.618s
And it fails...
npm -v
5.6.0
With sudo:
sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.794s
And it fails...
npm -v
5.6.0
This also fails...
sudo npm install npm#latest -g
I followed the directions found on this Q&A, completely removing npm and node from my system and reinstalling them from scratch, and it also fails to update.
Screenshot, per request:
Close the terminal, and then re-open the terminal and running:
$ npm -v
5.6.0
sudo twice:
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.478s
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.434s
Also fails:
$ npm -v
5.6.0
What did I miss? What's going on here?
This works on my mac.
Based on docs https://docs.npmjs.com/troubleshooting/try-the-latest-stable-version-of-npm :
npm install -g npm#latest
There is a note stated on the docs that depends on your installation method, you might addd some sudo.
Upgrading on *nix (OSX, Linux, etc.)
(You may need to prefix these commands with sudo, especially on Linux,
or OS X if you installed Node using its default installer.)
npm install -g npm#latest
works fine!!
and you can also replace the latest for specific versions
like
npm install -g npm#5.6.0
I hope it will help!!!
Perhaps you have already solved this, but here is what I found when I had exactly this issue. I had 2 versions of npm installed.
I verified this as follows:
grep \"version\" ~/.npm-packages/lib/node_modules/npm/package.json
"version": "6.2.0"
grep \"version\" /usr/local/lib/node_modules/npm/package.json
"version": "5.6.0",
I worked around the issue by updating the path in my bash profile, but would like to know why (how) I ended up with 2 versions. Here is the update:
tail -2 ~/.bash_profile
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
In my case, none of the previous answers worked. For me, a working solution was a simple, five-step process.
Make sure (the old version of) npm is installed.
npm -v
If npm is not installed, then install it on the Mac with Node.js.
Globally installed the desired version of npm.
npm install -g npm#latest
This command uses the old version of npm (installed by Node), to globally install the latest version of npm at ~/.npm-global/. Once installed, close and open a new terminal shell.
Remove the old version of npm installed by Node
rm -r /usr/local/lib/node_modules/npm/
Sometimes this doesn't work, so I had to go into finder to delete the /npm/ folder.
Make sure to set the correct path variable.
echo $PATH
If ~/.npm-global/bin does not show up between the colons, then update the path variable. Open up ~/.zshrc in a text editor and add the following line. If you don't use zsh, open the profile for your corresponding shell (i.e. ~/.bash_profile)
export PATH=$PATH:$HOME/.npm-global/bin
Save your changes and close the text editor.
Close and reopen the terminal shell and run npm -v to check that npm is correctly on the latest version.
The reason for updating the path variable is because the npm cli suggests you update npm with npm install -g npm which will install npm at a different location than where Node installs npm originally.
In my case, only the following has helped:
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --ignore-dependencies node
brew install node
EDIT NOV 21: These days, I bypass brew entirely and use "n":
https://www.npmjs.com/package/n
And so I can change between versions too.
I faced the same problem.
You might have already installed the npm version, and now it is time to point the new npm version install. You can do that by following below steps.
sudo nano /usr/local/lib/node_modules/npm/package.json
change "version" : "5.6.0" to "verison": "5.8.0"
In my case, I'm using nvm to manage different versions of node. In order to upgrade npm version, I have to
1 - Install the latest version of npm by navigating to your current
version of node
cd ~/.nvm/versions/node/v10.9.0
npm install npm
or you can probably use
nvm install-latest-npm
2 - Edit $PATH to point to your current version of node
NPM_PACKAGES="${HOME}/.nvm/versions/node/v10.9.0"
PATH="$NPM_PACKAGES/bin:$PATH"
On my macOS the homebrew-installed npm did not want to upgrade due to pre-existing link file. I ran the install with --force flag and now things are okay.
$ npm --version
6.14.16
$ npm install -g npm#8
npm ERR! EEXIST: file already exists, symlink ...
$ npm install -g --force npm#8
npm WARN using --force I sure hope you know what you are doing.
+ npm#8.19.2
$ npm --version
8.19.2
Note also that in my case, no 'sudo' was required, thanks to homebrew. To check if your npm is installed with homebrew, use brew list.
$ brew list | grep node
node#12
I'm using windows 10 with git and node installed. Running :
npm install -g bower
resulsts in
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit sheerun/fs-write-stream-atomic#v1.0.4-fix resetting remote C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/sheerun/fs-write-stream-atomic.git C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7: undefined
....
You should try to run this command as root. On Windows, start your CommandLine as administrator and under Mac or Linux use
sudo npm install -g bower
Installing git and running npm install from git-bash worked for me. Make sure you are in the correct directory.
Refer more here for solution
git is not installed or not in the PATH
i use windows and i have same problem when i want to install react-native-router-flux , for me that is solved when i use git bash to install it instead of command line, i hopefully this is help you .
I am having a problem installing ionic.
Cordova was installed, but I am still getting the below error.
Bankims-MacBook-Pro:Documents bankimdebnath$ sudo npm install -g cordova ionic
tar.unpack untar error /tmp/npm-776-1c23f39a/registry.npmjs.org/winston/-/winston-1.1.2.tgz
tar.unpack untar error /tmp/npm-776-1c23f39a/registry.npmjs.org/lodash/-/lodash-3.10.1.tgz
tar.unpack untar error /tmp/npm-776-1c23f39a/registry.npmjs.org/lodash/-/lodash-2.4.2.tgz
Darwin 15.0.0
argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
node v4.2.2
npm v3.5.0
unexpected eof
If you need help, you may report this error at:
https://github.com/npm/npm/issues
Please include the following file with any support request:
/Documents/npm-debug.log
Bankims-MacBook-Pro:Documents bankimdebnath$
try deleting npm package folder and npm install again.
if not try with downgrading node to 0.10.x version.
When I compile with gulp, I got an error like below. How can I fix it?
module.js:339
throw err;
^
Error: Cannot find module 'gulp-sass'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/flyscoot.com/gulpfile.js:2:12)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Just do npm update and then npm install gulp-sass --save-dev in your root folder, and then when you run you shouldn't have any issues.
Edit your package.json. Change:
"gulp-sass": "^2.3.2"
to
"gulp-sass": "3.0.0"
Delete the node_modules folder and run npm install again.
Source: https://github.com/codecombat/codecombat/issues/4430#issuecomment-348927771
Did you check this question?
May be possible solution is:
rm -rf node_modules/
npm install
I had the same problem, and I resolve doing this npm update. But I receive the message about permission, so I run:
sudo chwon -R myuser /home/myUserFolder/.config
This set permissions for my user run npm comands like administrator. Then I run this again:
npm update
and this:
npm install gulp-sass
Then my problem with this was solved.
Try this:
npm install -g gulp-sass
or
npm install --save gulp-sass
I had the same problem on my new Windows 10 machine. I had to intall the Windows build tools with npm install -g windows-build-tools. (https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration)
i was also facing the same issue,
The possible solution is to install the gulp-sass module, but if you will run the below command npm install -g gulp-sass or npm install --save gulp-sass, This is not going to be updated on node-sass project's end.
This version of node-sass is missing (returns a 404) and google web-starter-kit v0.6.5 has depended on it for a long time, since Dec 2016. So, it has been working for a long time and must have just disappeared.
Downloading binary from
https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download
"https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
HTTP error 404 Not Found
The only workaround is to upgrade node-sass:
npm i gulp-sass#latest --save-dev to fix the issue.
I had same error on Ubuntu 18.04
Delete your node_modules folder and run
sudo npm install --unsafe-perm=true
Make sure python is installed on your machine, Python is required for node-sass.
I had this issue for days looking for answers. My error log was similar to this npm just won't install node sass
The only problem was the node version. Maybe it can help some of you.
I downgraded my Node.js from 9.3.0 to 6.12.2 and run:
npm update
In the root folder where package.json is located, run npm outdated. You'll get outdated packages returned with some details. In those details, you'll see the current version number of the outdated package.
After then, open the package.json file and manually change the version number of the corresponding package.
Then delete the node_modules folder and run npm install. It should solve this issue.
I ran : npm i gulp-sass#latest --save-dev
That did the magic for me
Ive faced the same troubles with gulp-sass in my VSCode environment.
Also, I was observing a lot of fails during npm installing and I could not start gulp (as outcome).
The way how I fixed it:
delete packages
npm i
npm i gulp-sass --save-dev
Now it works.
Those who are getting this error, please downgrade the Node.js you are using.
Step 1 :
Uninstall the one you are using and install the version you prefer. I installed v6.12.3. My previous Node.js version was v9.4.0.
Step 2 :
Download Node.js.
Hope this will work.
I worked with Yarn and I got the same issue and I solve it doing this:
delete node_modules
yarn install
yarn upgrade
yarn install gulp-sass --save-dev
Try this to fix the error:
Delete node_modules directory.
Run npm i gulp-sass#latest --save-dev
Solution:
const sass = require('gulp-sass')(require('sass'));
npm install gulp-sass sass
I'm trying to install docpad and following the guide on: http://docpad.org/docs/install
When I issue the command:
npm install -g docpad#6.63
I get the following npm error:
npm ERR! Error: No compatible version found: taskgroup#'~3.3.7n'
npm ERR! Valid install targets:
npm ERR! ["2.0.0","3.0.0","3.1.0","3.1.1","3.1.2","3.2.0","3.2.2","3.2.3","3.2.4","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8"]
My node version: v0.10.15
My npm version: 1.2.18
I'm running Kubuntu 13.10 with all updates.
I checked if there is an issue reported for this on github, there isn't. Should I report this as an issue or am I doing something wrong?
Same problem here (Kubuntu 13.10).
I sugggest to go back to a previous version of docpad for the moment. On Ubunto/Debian there is another pitfall: some node modules depend on the nodejs executable to be available under node, so you need the additional package nodejs-legacy.
This worked for me:
sudo apt-get install nodejs-legacy
npm install docpad#6.55.6
Bug on DocPad's behalf, that n shouldn't have been there. Now fixed in v6.63.5. Thanks for the report!