React Native cannot npx init project, cannot find module error - javascript

npx react-native init MyApp
√ Downloading template × Copying template error Error: Cannot find
module
'C:\Users\%%%%\AppData\Local\Temp\rncli-init-template-rVvcjE\node_modules\react-native\template.config'
Require stack:
- C:\Users\%%%%%\node_modules\react-native\node_modules#react-native-community\cli\build\commands\init\template.js
- C:\Users\%%%%%\node_modules\react-native\node_modules#react-native-community\cli\build\commands\init\init.js
- C:\Users\%%%%%\node_modules\react-native\node_modules#react-native-community\cli\build\commands\init\index.js
- C:\Users\%%%%%\node_modules\react-native\node_modules#react-native-community\cli\build\commands\index.js
- C:\Users\%%%%%\node_modules\react-native\node_modules#react-native-community\cli\build\index.js
- C:\Users\%%%%%\node_modules\react-native\cli.js
npx react-native info
info Fetching system and libraries information... System:
OS: Windows 10 10.0.18363
CPU: (8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx
Memory: 3.88 GB / 6.80 GB Binaries:
Node: 12.13.1 - C:\Program Files\nodejs\node.EXE
npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD SDKs:
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29
Build Tools: 28.0.3, 29.0.2 IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5977832 npmPackages:
react-native: 0.61.5 => 0.61.5
To avoid unnecessary responses npm uninstall react-native-cli -g has been already done.
rncli-init-template-rVvcjE from the file path mentioned above does not even exist and I am not sure why. Thanks, everybody for help in advance I am new to stack overflow I have only been programming competitively so far. No stranger to algorithms but for cross-platform development frameworks, I'm a newbie.

Try to init with yarn. Yarn has a better performance than npm (link July 2019).
Install yarn first
npm install -g yarn
Install react-native-cli. If don't work try with sudo.
yarn global add react-native-cli
Create yout project
react-native init myapp
Related post

first uninstall your nodejs using nodejs setup(the same version you have installed)
reboot your computer (optional)
after all install again nodejs (nodejs.org/en/download/) and all will be fine.

Related

I cant install prompt-sync in visual studio

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\ibcph> npm install prompt-sync
up to date, audited 215 packages in 3s
9 packages are looking for funding
run npm fund for details
6 vulnerabilities (1 moderate, 4 high, 1 critical)
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit for details.
PS C:\Users\ibcph>
It is already installed to your current working directory C:\Users\ibcph.
Are you trying to install it globally?
npm install -g prompt-sync

module schedule/tracking does not exist in the Haste module map

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i3-7100 CPU # 3.90GHz
Memory: 559.26 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.11.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
IDEs:
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.0.0 => 16.0.0
react-native: ^0.57.3 => 0.57.3
npmGlobalPackages:
react-native-cli: 2.0.1
here is react-native info
similar solutions from GitHub does not work for me
The error appears due to the renaming of schedule/tracking to schedule/tracing from react#16.5.1 to react#16.5.2.
The issue is resolved by choosing the correct version of react for your react-native version:
RN <= 0.57.2 --> react <= 16.5.1
Be sure to lock your react version in this case. Your package.json should look like this: react#16.5.1. Check that there isn't any ^ before the version.
(having react#^16.5.1 in your package.json may resolve to a react version >= 16.5.1, which will NOT work)
example command: yarn add react#16.5.1
RN >= 0.57.3 --> react >= 16.6
example command: yarn add react#16.6.0
For further Information you can check the Github Issue #21150 and Github Issue #21140.
Sidenote for Expo Users:
If you are using expo, be aware that expo <= 32.0.0 uses a react-native version <= 0.57.2 and therefore will require the react version to be <= 16.5.1
If it does not work immediately
Try to reset the cache of your packager before continuing: yarn start --reset-cache
If running with your versions of npm packages:
react: 16.0.0 => 16.0.0
react-native: ^0.57.3 => 0.57.3
We'll have the same error as below:
error: bundling failed: Error: Unable to resolve module `scheduler/tracing` from
`C:\projects\rnw\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-
dev.js`: Module `scheduler/tracing` does not exist in the Haste module map
Upgrade to the following versions:
"dependencies": {
"react": "16.6.3",
"react-native": "0.58.1"
},
And the error will be gone.
If there is an error related to module Schedule/tracking not found, use react-native 0.55.0 version. Above RN->0.55.0 version schedule/tracking package is renamed or moved to another module which is not found by node server.
Command: react-native init (Project Name) --version 0.55.0

Npm install not working for ionic 3, npm ERR! code Z_BUF_ERROR

I have issues for days. Now i try to create an ionic v3 app and every time it stops at line below.
√ Preparing directory .\firstProject - done!
√ Downloading and extracting blank starter - done!
? Integrate your new app with Cordova to target native iOS and Android? Yes
ionic integrations enable cordova --quiet
[INFO] Downloading integration cordova
[INFO] Copying integrations files to project
[OK] Integration cordova added!
Installing dependencies may take several minutes.
* IONIC DEVAPP *
Speed up development with the Ionic DevApp, our fast, on-device testing mobile app
Test on iOS and Android without Native SDKs
LiveReload for instant style and JS updates
–> Install DevApp: https://ionicframework.com/docs/pro/devapp/ <–
────────────────────────────────────────────────────────────
npm i
npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated hoek#2.16.3: The major version is no longer supported. Please update to 4.x or newer
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache_logs\2018-09-01T04_12_23_741Z-debug.log
[ERROR] Non-zero exit from subprocess.
I looked up this
deprecated browserslist#2.11.3: Browserslist 2 could fail on reading
Browserslist >3.0 config used in other tools
but couldn't find anything that works.
The solution is pretty simple, just clear NPM cache
npm cache clear --force
and then, try again
npm install

Cordova 6.4.0: android platform install Whitelist error

I'm setting up a first cordova projecct.
After installing globally Cordova and creting a first app repository
am trying to set up the android platform within this command:
cordova platform add android --save
But this action ends up by generation this error message:
BUILD FAILED
Total time: 0.989 secs Failed to install
'cordova-plugin-whitelist':Error:
/home/firas/Bureau/Cordova/HelloWorld/HelloWorld/platforms/android/gradlew:
Command failed with exit code 1
at ChildProcess.whenDone (/home/firas/Bureau/Cordova/HelloWorld/HelloWorld/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) Error:
/home/firas/Bureau/Cordova/HelloWorld/HelloWorld/platforms/android/gradlew:
Command failed with exit code 1
I have tried to remove and re-add the adroid platform , but the problem persists , also I have tried to install the whitelist plugin (cordova plugin add cordova-plugin-whitelist#1.0.0 )
but also I faced the same problem , and finish by not being able to build or run my first HelloWord app
Update Cordova version
Set Local Path
Cordova Tutorial
This issue appears especially with Cordova 6.4.0 (latest until 31 December 2016) .
To solve this problem, simply uninstall Cordova and re-install it for the version 6.0.0 which affords more stability with the whitelist component.
Steps:
npm uninstall -g cordova
npm install -g cordova#6.0.0

Travis CI Build Keeps Failing

I have a project that I am trying to incorporate Travis CI into for testing.
For the life of me, Travis CI keeps 'failing' when I do a Pull Request and/or push to my repos on GitHub.
Here is my .travis.yml file:
language: node_js
node_js:
- "node"
before_script:
-npm install -g webpack
-npm install -g mocha
-npm install -g chai
-npm start
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Here is the message from Travis CI about the error:
Using worker: worker-linux-docker-f87d2e7f.prod.travis-ci.org:travis-linux-7
system_info
Build system information
Build language: node_js
Build group: stable
Build dist: precise
Build image provisioning date and time
Thu Feb 5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
fix.CVE-2015-7547
$ export DEBIAN_FRONTEND=noninteractive
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-backports_multiverse_source_Sources.gz is not what the server reported 5886 5888
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-amd64_Packages.gz is not what the server reported 36669 36677
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-i386_Packages.gz is not what the server reported 36729 36733
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libc-bin libc-dev-bin libc6-dev
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc-bin libc-dev-bin libc6 libc6-dev
4 upgraded, 0 newly installed, 0 to remove and 221 not upgraded.
Need to get 8,844 kB of archives.
After this operation, 9,216 B disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.13 [2,943 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.13 [84.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.13 [1,179 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.13 [4,637 kB]
Fetched 8,844 kB in 0s (31.7 MB/s)
Preconfiguring packages ...
(Reading database ... 69991 files and directories currently installed.)
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.15-0ubuntu10.13) ...
(Reading database ... 69991 files and directories currently installed.)
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.15-0ubuntu10.13) ...
Setting up libc-dev-bin (2.15-0ubuntu10.13) ...
Setting up libc6-dev (2.15-0ubuntu10.13) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
git.checkout
0.46s$ git clone --depth=50 --branch=master https://github.com/NAME/mood.ly.git NAME/mood.ly
Cloning into 'NAME/mood.ly'...
remote: Counting objects: 1183, done.
remote: Compressing objects: 100% (507/507), done.
remote: Total 1183 (delta 616), reused 1170 (delta 608), pack-reused 0
Receiving objects: 100% (1183/1183), 665.78 KiB | 0 bytes/s, done.
Resolving deltas: 100% (616/616), done.
Checking connectivity... done.
$ cd NAME/mood.ly
$ git checkout -qf 6bb7813f901f8d3cca359f8a9a1124df4dda86fe
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
Updating nvm to v0.31.0
2.25s$ nvm install node
Downloading https://nodejs.org/dist/v6.1.0/node-v6.1.0-linux-x64.tar.xz...
######################################################################## 100.0%
Now using node v6.1.0 (npm v3.8.6)
$ node --version
v6.1.0
$ npm --version
3.8.6
$ nvm --version
0.31.0
install
47.43s$ npm install
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN excluding symbolic link index.js -> lib/sass.js
npm WARN excluding symbolic link lib/index.js -> sass.js
mood.ly#1.0.0 /home/travis/build/NAME/mood.ly
├─┬ babel-cli#6.8.0
│ ├─┬ babel-polyfill#6.8.0
│ │ └── babel-regenerator-runtime#6.5.0
│ ├── babel-runtime#6.6.1
│ ├─┬ bin-version-check#2.1.0
│ │ ├─┬ bin-version#1.0.4
***A BUNCH OF OTHER DEPENDENCIES* (it goes over 30K characters so I had to redact it)**
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
0.00s$ -npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start
/home/travis/build.sh: line 45: eval: -n: invalid option
eval: usage: eval [arg ...]
The command "-npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start" failed and exited with 2 during .
Your build has been stopped.
Would really appreciate some help/advice with this.
Thanks in advance.
The command "-npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start" failed and exited with 2 during .
This line should be the hint. Your npm has a dash before it (i.e: -npm). Add a space between the - and npm in your configuration.
before_script:
- npm install -g webpack
- npm install -g mocha
- npm install -g chai
- npm start
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

Categories