issue when running npm run serve in vue project - javascript

I've got an issue when try running server for vue project
this is the issue
ERROR Error: No valid exports main found for
' PROJECT PATH\node_modules\colorette'
Error: No valid exports main found for
'PROJECT PATH\node_modules\colorette'
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\AlaaMohammed\PhpstormProjects\vue-2\node_modules\autoprefixer\lib\autoprefixer.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:1139:30) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vue-2#0.1.0 serve:
vue-cli-service serve npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the vue-2#0.1.0 serve script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
I want some to response to my problem

try to reinstall the colerette plugin version 1.2.0 manually
npm i colorette#1.2.0

Upgrade node to version 14.5 will resolve this issue.

I did the following and it worked:
1)_ First i checked the versions
npm outdated
npm update
npm install
npx npm-check-updates - u
2)_ Once i was 100% sure the problems didn't come from that source, i typed the following:
npm install autoprefixer#9.8.0
and it solved the problem.
Note: try to "npm start" before you connect the scss to the App, just to see if you can visualize something (like: hello world) in the browser, if everything is fine, create the folder scss with the main.scss inside of it, import it and then try the steps.

My node -v: v16.1.0
What worked for me npm ci

Updating the node version can solve your problem.

Related

Next.js - `npm run build` failed

Trying to build my app with target: 'serverless' in next.config.js (In-order to deploy on AWS Lambda).
When running npm run build I'm getting the following output:
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://err.sh/next.js/built-in-css-disabled
info - Using external babel configuration from C:\Users\User\Desktop\mysite\.babelrc
info - Creating an optimized production build
warn - Compiled with warnings
./node_modules/require_optional/index.js
Critical dependency: the request of a dependency is an expression
./node_modules/node-pre-gyp/lib/pre-binding.js
Critical dependency: the request of a dependency is an expression
./node_modules/node-pre-gyp/lib/util/versioning.js
Critical dependency: the request of a dependency is an expression
./node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in 'C:\Users\User\Desktop\mysite\node_modules\node-fetch\lib'
./node_modules/mongodb/lib/operations/connect.js
Module not found: Can't resolve 'mongodb-client-encryption' in 'C:\Users\User\Desktop\mysite\node_modules\mongodb\lib\operations'
./node_modules/node-pre-gyp/lib/util/compile.js
Module not found: Can't resolve 'node-gyp' in 'C:\Users\User\Desktop\mysite\node_modules\node-pre-gyp\lib\util'
./node_modules/node-pre-gyp/lib/util/compile.js
Module not found: Can't resolve 'npm' in 'C:\Users\User\Desktop\mysite\node_modules\node-pre-gyp\lib\util'
./node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>
> Build error occurred
Error: package.json does not exist at C:\package.json
at Object.module.exports.wr/F.exports.find (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:188263:15)
at Object.<anonymous> (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:154078:28)
at Object.paWE (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:154141:30)
at __webpack_require__ (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:23:31)
at Object.xDbK (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:189175:64)
at __webpack_require__ (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:23:31)
at Object.gL7F (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:123042:67)
at __webpack_require__ (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:23:31)
at Module.IlR1 (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:53618:12)
at __webpack_require__ (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:23:31)
at Module.ScIc (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:81256:17)
at __webpack_require__ (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:23:31)
at C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:91:18
at Object.<anonymous> (C:\Users\User\Desktop\mysite\.next\serverless\pages\_error.js:94:10)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
info - Collecting page data .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#0.1.0 build 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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-09-12T19_38_11_418Z-debug.log
What is the meaning of this error?
Error: package.json does not exist at C:\package.json
And what about all the Module not found: Can't resolve errors?
EDIT:
I have package.json in project folder.
when I run npm run dev it works just fine.
I don't know why he is complaining about C:\package.json
(the project is not under C:\, but C:\Users\User\Desktop\mysite)
When you npm run it will run whatever it is inside the script section of package.json in the directory but for some reason, it is invoked in here. I think there are 2 possibilities.
1/Either your current package.json somehow looks for C:\package.json and the error occurs
2/Your npm cache is including the C:\package.json for some reason try npm cache clean or npm cache clean --force
I think when you read this:
npm ERR! This is probably not a problem with npm.
Probably don`t depend from Npm or nodejs. I supppose some modules are missing in this folder:
./node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in
'C:\Users\User\Desktop\mysite\node_modules\node-fetch\lib'
./node_modules/mongodb/lib/operations/connect.js
Module not found: Can't resolve 'mongodb-client-encryption' in
'C:\Users\User\Desktop\mysite\node_modules\mongodb\lib\operations'
./node_modules/node-pre-gyp/lib/util/compile.js
Module not found: Can't resolve 'node-gyp' in
'C:\Users\User\Desktop\mysite\node_modules\node-pre-gyp\lib\util'
./node_modules/node-pre-gyp/lib/util/compile.js
Module not found: Can't resolve 'npm' in
'C:\Users\User\Desktop\mysite\node_modules\node-pre-gyp\lib\util'
I suggest to write in console:
npm install encoding -g
npm install mongodb-client-encryption -g
npm install node-gyp -g
npm install npm#latest -g
and change folder into "C:\Users\User\Desktop\mysite" then type:
npm install encoding --save
npm install mongodb-client-encryption --save
npm install node-gyp --save
npm install npm#latest --save
And another thing, did you do "npm init"? To initialize your folder then edit it.
I was this error, my solution was:
First, in the packege.json file, in the section scripts, we must modify the property “build”: "next build && next export", and a new property "export": "next export"
Second, we must establish the component and data folders in the root of the project
Third: use the command: npm dev build
Tha give to you and folder with the name "out"
package.json
out folder

I'm facing a problem with npm run serve ( vue js project )

I am getting an error when trying to run npm run serve.
At fist I tried to work with vue in laravel project and run the "npm run serve command".
After that I uninstalled vue as well as vue/cli and reinstall them again. Then i created new vue project in independent folder. But when I am trying to run server as -> npm run serve at I'm getting the same error as when i tried it in the laravel project.
I used below codes for installation:
npm run serve => the vue and laravel project
npm run dev => the laravel project
This is the error :
$ npm run serve
vue-1#0.1.0 serve P:\codes & projects\vue\Tutorials\vue-1
vue-cli-service serve
'projects\vue\Tutorials\vue-1\node_modules\.bin\' is not recognized as an intern
al or external command,
operable program or batch file.
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'P:\#vue\cli-service\bin\vue-cli-service.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js
:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-1#0.1.0 serve: vue-cli-service serve**
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-1#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ahmad\AppData\Roaming\npm-cache\_logs\2020-09-13T16_12_03_
919Z-debug.log
And This is an image for the error in the bash terminal :
enter image description here

why npm start giving ELIFECYCLE error reactjs [duplicate]

I'm trying to learn react, so I have this sample code for the full-stack react voting app, and I am trying to get it to work but after running npm install followed by npm start I receive the following error when I run npm start can anyone help me with this issue:
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "server"
npm ERR! node v7.5.0
npm ERR! npm v4.3.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! voting_app#1.1.0 server: `live-server --public --
host=localhost --port=3000 --middleware=./disable-browser-cache.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the voting_app#1.1.0 server script 'live-server --
public --host=localhost --port=3000 --middleware=./disable-browser-
cache.js'.
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 voting_app
package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! live-server --public --host=localhost --port=3000 --
middleware=./disable-browser-cache.js
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs voting_app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls voting_app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/ItsMeMrLi/.npm/_logs/2017-02-17T22_48_03_581Z-
debug.log
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.5.0
npm ERR! npm v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! voting_app#1.1.0 start: `npm run server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the voting_app#1.1.0 start script 'npm run server'.
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 voting_app
package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run server
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs voting_app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls voting_app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/ItsMeMrLi/.npm/_logs/2017-02-17T22_48_03_655Z-
debug.log
Here is my package.json:
{
"name": "voting_app",
"version": "1.1.0",
"author": "Fullstack.io",
"scripts": {
"go": "open http://localhost:3000; npm run server",
"e2e": "nightwatch",
"test": "./node_modules/.bin/concurrently -k 'npm run server' 'npm
run e2e'",
"start": "npm run server",
"server": "live-server public --host=localhost --port=3000 --
middleware=./disable-browser-cache.js"
},
"private": true,
"devDependencies": {
"concurrently": "2.2.0",
"live-server": "git://github.com/acco/live-server.git"
},
"dependencies": {
"semantic-ui": "git://github.com/Semantic-Org/Semantic-
UI.git#27d58a01793b66318478fbc5b6676804d22d065d"
}
}
And finally my log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#4.3.0
3 info using node#v7.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle voting_app#1.1.0~prestart: voting_app#1.1.0
6 silly lifecycle voting_app#1.1.0~prestart: no script for prestart, continuing
7 info lifecycle voting_app#1.1.0~start: voting_app#1.1.0
8 verbose lifecycle voting_app#1.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle voting_app#1.1.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/ItsMeMrLi/.rvm/gems/ruby-2.3.1/bin:/Users/ItsMeMrLi/.rvm/gems/ruby-2.3.1#global/bin:/Users/ItsMeMrLi/.rvm/rubies/ruby-2.3.1/bin:/Users/ItsMeMrLi/.cargo/bin:/usr/local/Cellar/smlnj/110.74/libexec/bin:/usr/local/bin:/Users/ItsMeMrLi/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Downloads/geckodriver:/usr/local/bin:/Users/ItsMeMrLi/.rvm/bin
10 verbose lifecycle voting_app#1.1.0~start: CWD: /Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app
11 silly lifecycle voting_app#1.1.0~start: Args: [ '-c', 'npm run server' ]
12 silly lifecycle voting_app#1.1.0~start: Returned: code: 1 signal: null
13 info lifecycle voting_app#1.1.0~start: Failed to exec start script
14 verbose stack Error: voting_app#1.1.0 start: `npm run server`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:192:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:192:7)
14 verbose stack at maybeClose (internal/child_process.js:890:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid voting_app#1.1.0
16 verbose cwd /Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app
17 error Darwin 16.4.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v7.5.0
20 error npm v4.3.0
21 error code ELIFECYCLE
22 error errno 1
23 error voting_app#1.1.0 start: `npm run server`
23 error Exit status 1
24 error Failed at the voting_app#1.1.0 start script 'npm run server'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the voting_app package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error npm run server
24 error You can get information on how to open an issue for this project with:
24 error npm bugs voting_app
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls voting_app
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
Step 1: $ npm cache clean --force
Step 2: Delete node_modules by $ rm -rf node_modules (rmdir /S /Q node_modules in windows) folder or delete it manually by going into the directory and right-click > delete / move to trash. If you are not updating your packages you can delete the package-lock.json file too.
Step 3: npm install
To start again,
$ npm start
This worked for me. Hopes it works for you too.
PS: Still if it is there, kindly check the error it is displaying in red and act accordingly. This error is specific to node.js environment.
Cleaning Cache and Node_module are not enough.
Follow this steps:
npm cache clean --force
delete node_modules folder
delete package-lock.json file
npm install
It works for me like this.
I resolve this error running following code
npm cache clean
then delete node_modules directory from my project structure manually or with following command
rm -rf node_modules
After That install dependencies again using
npm install
first i ran:
npm run clean
(even though it came with errors)
Then i deleted the node_modules folder and ran
npm install
This seems to have solved the problem.
I was getting similar error messages on a 16.04 Ubuntu instance with DigitalOcean while running npm run build on an app made with create-react-app (link). I upgraded the instance from 512MB RAM to 1GB ($5/mo to $10/mo) and then the script was able to run.
I post this here to point out that you may get this error due to resource limitations, which I didn't really see explained elsewhere on issue pages and SO answers. And nothing I saw in the error logs pointed me in this direction.
Change access in node_modules directory
chmod -R a+rwx ./node_modules
This solution is for Windows users.
You can open the node.js installer and give the installer some time to compute space requirements and then click next and click remove. This will remove node.js from your computer and again reopen the installer and install it in this path - C:\Windows\System32
or
Cleaning Cache and Node_module will work.
Follow this steps:
npm cache clean --force
delete node_modules folder
delete package-lock.json file
npm install
Faced this exact problem,
for me it worked by deleting package-lock.json and re-running npm install
If that doesn't resolve it try
delete package-lock.json
npm cache clean --force
npm install
npm start
Delete node_modules and package-lock.json, and then run npm install. It worked perfectly here(run command below inside project root):
rm -rf node_modules && rm ./package-lock.json && npm install
I was getting this npm ERR! code ELIFECYCLE error while running a build. Clearing the cache and removing the package-lock.json files did not fix it.
In my case there was an Angular build running on a Docker image that was causing this. The root cause turned out to be running the build on Docker in MacOS, which runs the Docker inside a Linux VM, and has by default 2GB memory allocated.
Giving Docker more memory fixed this issue for me. Have to say, the error message could have been quite a bit more clear..
A helpful answer for me was Call retries were exceeded exception while ng build
workaround: Remove the lock file.
rm .\package-lock.json
source: https://github.com/mapbox/node-pre-gyp/issues/298 (floriantraber)
React Application: For me the issue was that after running npm install had some errors.
I've went with the recommendation npm audit fix. This operation broke my package.json and package-lock.json (changed version of packages and and structure of .json).
THE FIX WAS:
Delete node_modules
Run npm install
npm start
Hope this will be helpfull for someone.
npm install --unsafe-perm
worked for me. See https://docs.npmjs.com/. The --unsafe-perm parameter lets you run the scripts from the package instalation as root. The problem in my case was that some depandencies failed to install.
This solution fixed the error in Win10.
Please install globally npm install -g node-pre-gyp
i tried to solve this problem with this way
rm -rf node_modules && rm ./package-lock.json && npm install
But for me its not work.
I just restart my machine and its working perfectly.
Am Linux user ,Machine HP.
I recommend you update your node version to the latest node version recommended by your application or for short update your node version. I encountered this same problem using node version 11.1 but my application was recommending atleast version 10.x.x or 12.x.x
I tried all the suggested reply on this thread but non seemed to work for me untill only when i updated my node version to the recommended latest version .i.e. version 12.16.3 then my application ran.
I just wanted to do run npm run dist to apply some changes for SCSS files, but after hours of suffering, here's what worked for me:
npm cache clean --force
delete node_modules folder
delete package-lock.json file
sudo npm install npm#latest -g this will upgrade npm to latest version
npm audit fix --force
npm upgrade --force
npm install
After these I could finally compile SCSS files successfully with npm run dist.
Check for port availability as well if you encounter below message :
Error: listen EACCES 127.0.0.1:8080
at Object._errnoException (util.js:999:13)
at _exceptionWithHostPort (util.js:1020:20)
at Server.setupListenHandle [as _listen2] (net.js:1362:19)
at listenInCluster (net.js:1420:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1535:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:102:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
A possibly unexpected cause: you use Create React App with some warnings left unfixed, and the project fails on CI (e.g. GitLab CI/CD):
Treating warnings as errors because process.env.CI = true.
[ ... some warnings here ...]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Solution: fix yo' warnings!
Alternative: use CI=false npm run build
See CRA issue #3657
(Ashamed to admit that it just happened to me; did not see it until a colleague pointed it out. Thanks Pascal!)
I'm using ubuntu 18.04 LTS release and I faced the same problem I tried to clean cache as above suggestions but it didn't work for me. However, I found another solution.
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
npm start
I run this command and it started to work
In my case, I actually ran into this error "code ELIFECYCLE" in a Jenkins job. I tried to clean npm cache but it didn't work and also checked the memory of the Jenkins build server which looks okay. Then, I found the compiling of the react project actually failed in Jenkins but not in my local or when manually running the build on the Jenkins build server, and Jenkins also mentioned "Treating warnings as errors because process.env.CI = true". It looks like the warnings in my project cause the error on Jenkins. Therefore, I changed CI to true in the Jenkins job for now. That actually fixed the build error of Jenkins before I cleared those warnings.
Try to reinstall the cli package globally. In my case, I was trying to test a Vue.js tutorial when I get the same error message. The other thing I did was run the vue command again but this time using webpack-simple and that is why I am not sure wich one solved the problem but now it is working.
The port is probably being used by another application, try listing and see if it's your application:
lsof -i:8080
You can kill the process of this port:
lsof -ti:8080 | xargs kill
I've been bothered by this issue for a long time. For me, the version of node was the problem.
My npm and node were 6.1.0 and 8.11.3, respectively. However, I didn't realize that I had updated my node accidentally to 12.*.*.
It then began to install GCX stuff whenever npm i, which was unnecessary before.
I downgraded my node to 8 and it worked!
Its weird but it works for me
Go to
control panel -->System and Security--> System --> Advanced System
Security--> Environment Variables
In Environment Variable popup you will edit the user variable PATH and add "C:\Windows\System32" value as semicolon separated to the existing value.
Not but not least restart the Machine.
I did follow steps, it works:
1.
npm cache clean --force
remove the package-lock.json file
restart my WebStorm
Usually killall node command fixes mine.
Resolved like this:
# chown -R <user>: node_modules
Make sure to use the latest npm version while installing packages using npm.
While installing JavaScript, mention the latest version of NodeJS. For example, while installing JavaScript using devtools, use the below code:
devtools i --javascript nodejs:10.15.1
This will download and install the mentioned NodeJS version. This worked for me.
I was issuing the npm start command with the folder of the project opened at Sublime Text. Closing ST and restarting the server did the work for me.

how to run an existing project of react native

I wanted to download and run someone else's project in order to consider its functions. I ran into a number of problems ... that it does not deign to start, and I just don’t know what to do, help, please
https://github.com/sunlight3d/react_native_v0.49/tree/master/61-Realm%20React%20Native%235.Filter%20data%20and%20working%20with%20To-Many%20Relationships/code/tutorialProject
1) copied to the working folder tutorial project
2) opened VS code
3) went into the working folder and clicked open in cmd folder tutorial project
4) then I enter react-native run-android
and get fiasco
d:\JS\tutorialProject>react-native init tutorialProject
internal/modules/cjs/loader.js:657 throw err; ^
Error: Cannot find module 'graceful-fs' at
Function.Module._resolveFilename
(internal/modules/cjs/loader.js:655:15) at Function.Module._load
(internal/modules/cjs/loader.js:580:25) at Module.require
(internal/modules/cjs/loader.js:711:19) at require
(internal/modules/cjs/helpers.js:14:16) at Object.<anonymous>
(d:\JS\tutorialProject\node_modules\react-native\local-cli\cli.js:12:1)
at Module._compile (internal/modules/cjs/loader.js:805:30) at
Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
at Module.load (internal/modules/cjs/loader.js:672:32) at
tryModuleLoad (internal/modules/cjs/loader.js:612:12) at
Function.Module._load (internal/modules/cjs/loader.js:604:3)
I started googling and found something to do with some dependencies. Using react-native init MyProject
5) react-native init tutorialProject and getting the tighter right line
I try to start the server through npm and then it's funny ...
6) npm-intall
d:\JS\tutorialProject>npm install npm WARN deprecated core-js#1.2.7:
core-js#<2.6.5 is no longer maintained. Please, upgrade to core-js#3
or at least to actual version of core-js#2. npm WARN deprecated
connect#2.30.2: connect 2.x series is deprecated npm ERR! path
d:\JS\tutorialProject\node_modules\.bin\react-native npm ERR! code
EEXIST npm ERR! Refusing to delete
d:\JS\tutorialProject\node_modules\.bin\react-native: is outside
d:\JS\tutorialProject\node_modules\react-native and not a link npm
ERR! File exists: d:\JS\tutorialProject\node_modules\.bin\react-native
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Nick\AppData\Roaming\npm-cache\_logs\2019-04-16T18_15_13_614Z-debug.log
and here I am absolutely don't know. How to run someone else's project?
When you download after you need to install all package in package.json
npm install --save
then you need to start another terminal
npm start -- --reset-cache / npm start / react-native start
It's for starting your bundler
finally you can run your project
react-native run-android
From a computer with node install, you navigate a command line to the root of the project folder.
Then you install dependencies:
npm i
This installs all the libraries the project needs to build
Then you run the projects build script. This is defined in the projects package.json file. In that projects case, the script is called start. So:
npm run start
all dependencies and plugins have configured in package.json file. so you need to install:
npm install
then, you can start
react-native run-android
or
npm run start
if you already have a bundle app (android or ios ...)
react-native run-android / react-native run-ios
else you should run
react-native start
and then run :
react-native run-android (or ios)
This is the answer when you compile on windows and android studio
1.Open cmd(as an admin)
2. Npm install
3. Wait for build gradle in Android studio done compiling
4. Run on cmd react-native android-run
Sometimes you may get this error (refer image below)
This is a failure to build because of gradle error. To solve this, you may try to delete the files/folder in the error message and run again react-native android-run.
Just run
npm cache clean --force
npm i or npm install
Install Chocolatey
Chocolatey is a popular package manager for Windows. So at first, we need to install it on our system.
To install Chocolaty, Open Command Prompt with administrator privileges and run the command below.
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install -y nodejs.install python2 jdk8.
npm install –g react-native-cli
More Detail Follow this
Path in user variable upper section

How do I use Node.js modules?

I recently installed Node.js on a fresh Linode box, and I think I'm in a weird situation where I can't use require() to load any third party modules.
I've installed npm and have successfully installed modules via npm, but whenever I try to require one of the modules (or just some of my own code in the same directory), Node.js throws an error saying it can't find the module.
Any thoughts as to why this might be happening?
Here's an example error message:
root#li200-141:/home/mike# npm install sequelize
npm ERR! sudon't!
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm info it worked if it ends with ok
npm info version 0.2.2
npm info fetch http://registry.npmjs.org/sequelize/-/sequelize#0.4.2.tgz
npm info install sequelize#0.4.2
npm info activate sequelize#0.4.2
npm info build Success: sequelize#0.4.2
npm ok
root#li200-141:/home/mike# node
> var n = require('sequelize').Sequelize
Error: No such native module sequelize
at requireNative (node.js:83:32)
at cwdRequire (repl:27:10)
at [object Context]:1:9
at Interface.<anonymous> (repl:96:19)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:295:12)
at Interface.write (readline:132:30)
at Stream.<anonymous> (repl:77:9)
at Stream.emit (events:27:15)
at IOWatcher.callback (net:489:16)
Apparently, there is a bug in node v0.2.2 that prevents require from working properly from the REPL.
Try putting your code in a .js file instead. That worked for me.

Categories

Resources