I am not able to create my react application on npm - npm

$ npx create-react-app application
Error: EPERM: operation not permitted, mkdir 'C:\Users\snigdha'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20) C:\Program
Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98 var
doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27) Install for create-react-app#latest failed with code 7

Try to clean your cache with
npm cache clean

Related

agora npm start command gives me error with Error: spawn cd ENOENT

agora npm start command gives me error with Error: spawn cd ENOENT
can any one help me
`E:\Projects\Full Stack Projects\Video App by Alpha\agora-app-builder\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
throw ex;
^
Error: spawn cd ENOENT
at notFoundError (E:\Projects\Full Stack Projects\Video App by Alpha\agora-app-builder\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (E:\Projects\Full Stack Projects\Video App by Alpha\agora-app-builder\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (E:\Projects\Full Stack Projects\Video App by Alpha\agora-app-builder\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (E:\Projects\Full Stack Projects\Video App by Alpha\agora-app-builder\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn cd',
path: 'cd',
spawnargs: [ 'videoapp', '&&', 'npm', 'install' ]
}`
I run npm start after npm i and show me this error while I try many times as well with cmd admin

I have trouble with constructing a vue.js project by using npm or yarn

I have trouble with constructing a vue.js project by using npm or yarn.
the cmd: $ vue init webpack my-project
# Installing project dependencies ...
# ========================
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn C:\WINDOWS\system32\cmd.exe; ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\WINDOWS\\system32\\cmd.exe;',
path: 'C:\\WINDOWS\\system32\\cmd.exe;',
spawnargs: [ '-c', 'yarn install' ]
}
the picture

TypeError: Cannot read property 'database' of undefined. Any ideas?

I am working at this project https://github.com/ameCont/vue.git
Index.js file:
const fs = require('fs')
const path = require('path')
const Sequelize = require('sequelize')
const config = require('../config/config')
const db = {}
//console.log(config)
const sequelize = new Sequelize(
config.db.database,
config.db.user,
config.db.password,
config.db.options
)
fs
.readdirSync(__dirname)
.filter((file) => {
file !== 'index.js'
}
)
.forEach((file) => {
const model = sequelize.import(path.join(__dirName, file))
db[model.name] = model
})
db.sequelize = sequelize
db.Sequelize = Sequelize
module.exports = db
When I run
npm start
inside server directory I get the error
/home/ubuntu/vue/server/src/models/index.js:10
config.db.database,
^
TypeError: Cannot read property 'database' of undefined
at Object.<anonymous> (/home/ubuntu/vue/server/src/models/index.js:10:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/ubuntu/vue/server/src/app.js:7:21)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
[nodemon] app crashed - waiting for file changes before starting...
My config.js file contains:
module.exports = {
port: process.env.PORT || 8081,
db: {
database: process.env.DB_NAME || 'vue',
user: process.env.DB_USER || 'vue',
password: process.env.DB_PASS || 'vue',
options: {
dialect: process.env.DIALECT || 'sqlite',
host: process.env.HOST || 'localhost',
storage: 'vue.sqlite.sql'
}
}
}
It has || 'vue' so it shouldn't need a real database (I created one but the issue is the same)
I am beginner with vue.
Here JS: firebase.init error: TypeError: Cannot read property 'database' of undefined, the solution was to install some plugins.
But in my case which plugins?
If it helps, when I run
npm install sqlite3
I get this
> sqlite3#4.2.0 install /home/ubuntu/vue/server/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for sqlite3#4.2.0 and node#10.19.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ubuntu/vue/server/node_modules/sqlite3/build'
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "configure" "--fallback-to-build" "--module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /home/ubuntu/vue/server/node_modules/sqlite3
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/ubuntu/vue/server/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 5.4.0-26-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/ubuntu/vue/server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/vue/server/node_modules/sqlite3
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN eslint-plugin-import#2.20.2 requires a peer of eslint#2.x - 6.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-vue#6.2.2 requires a peer of eslint#^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.17.1 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#4.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#4.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Also, this topic doesn't help TypeError: Cannot read property 'database' of undefined
because I do have const config = require('../config/config')
Thanks for help!
Actually, in your config you have two exports, so for correctly accessing it you should name the exported objects:
module.exports.config = {
port: process.env.PORT || 8081,
db: {
database: process.env.DB_NAME || 'vue',
user: process.env.DB_USER || 'vue',
password: process.env.DB_PASS || 'vue',
options: {
dialect: process.env.DIALECT || 'sqlite',
host: process.env.HOST || 'localhost',
storage: 'vue.sqlite.sql'
}
}
}
module.exports.otherConfigs = {
// other configs ..
}
Then in model's index.js you import the configs like that:
const { config, otherConfigs } = require('../config/config')

Where is NPM config file?

I edited the npm config file with npm edit config. I made a syntax error in it and saved the file. Now, no matter what I try with npm, it will complain about it. I know what the syntax is and I would like to fix it, but I can't find the file anywhere.
C:\Users\Arthur>npm
Error: Failed parsing JSON config key cache: "C:\Users\Le Roi Arthur\AppData\Roaming\npm-cache"
at parseField (D:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at D:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (D:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (D:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at D:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at D:\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (D:\nodejs\node_modules\npm\lib\npm.js:225:22)
at D:\nodejs\node_modules\npm\lib\npm.js:263:24
at D:\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:82:13)
at Conf.f (D:\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at Object.onceWrapper (events.js:286:20)
D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Error: Failed parsing JSON config key cache: "C:\Users\Le Roi Arthur\AppData\Roaming\npm-cache"
at parseField (D:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at D:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (D:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (D:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at D:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at D:\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (D:\nodejs\node_modules\npm\lib\npm.js:225:22)
at D:\nodejs\node_modules\npm\lib\npm.js:263:24
at D:\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:82:13)
at Conf.f (D:\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at Object.onceWrapper (events.js:286:20)
D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Uninstalling and re-installing nodeJS doesn't fix the issue, the file is stored in cache somewhere. It's infuriately frustrating how hard it is to put my hands on that file.
Where can I find the npm config file ?
You need to edit npmrc file, take a look at documentation it will help you to find the appropriate one.
The four relevant files are:
Per-project config file: /path/to/my/project/.npmrc
Per-user config file: ~/.npmrc
Global config file: $PREFIX/npmrc
Built-in npm config file: /path/to/npm/npmrc
you can see the config file (and other) paths with the below command
npm config list

Why can't I restart my react-native application?

I'm new at react-native.
I reached to start my application but when I want to restart it I got this :
/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:83
ps.stdout.on('data', function (data) {
^
TypeError: Cannot read property 'on' of undefined
at buildProcessTree (/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:83:15)
at /usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:104:11
at Array.forEach (<anonymous>)
at ChildProcess.onClose (/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:99:31)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:978:16)
at Socket.stream.socket.on (internal/child_process.js:395:11)
at Socket.emit (events.js:189:13)
at Pipe._handle.close (net.js:610:12)
Why do I get this ?
I start my react-native app with npm start !
I found the solution.
I had to remove the file .expo in my folder.