I have problems in my terminal when I want to install something with npm (gulp).
Please help, if you know something with it.
roman#MacBook-Pro-Roman advanced % npm
Error: EROFS: read-only file system, mkdir '/Roman'
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/lib/config/core.js:80:13
at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:171:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:321:20)
at process._fatalException (internal/process/execution.js:165:25)
It looks to me you either have a file system that is set to read only. Possible due to some software/hardware issues or the permissions are not set correct for npm to write to the storage device.
I already found the answer:
sudo npm config set prefix ~/npm
Related
I'm getting the error below whenever I try to execute anything in my terminal (e.g. npm test or npm install)
I've tried to follow steps similar laid out here - NPM - Failed to replace env in config: ${NPM_TOKEN}. I've also tried setting my username and (encoded) password in my .npmrc file, none of which appear to work for me.
Not really sure what else I should try here ....
Error: Failed to replace env in config: ${NPM_BASE64_USERNAME_PASSWORD}
at /Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:415:13
at String.replace (<anonymous>)
at envReplace (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:411:12)
at parseField (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:389:7)
at /Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:328:23)
at ConfigChain.addString (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
at Conf.<anonymous> (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/config/core.js:316:10)
at /Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16
/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/npm.js:59
throw new Error('npm.load() required')
^
Error: npm.load() required
at Object.get (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/npm.js:59:13)
at process.errorHandler (/Users/andrew.lee/.nvm/versions/node/v14.17.1/lib/node_modules/npm/lib/utils/error-handler.js:208:32)
at process.emit (events.js:375:28)
at process._fatalException (internal/process/execution.js:163:25)
Even, I had encounter the issue similar to thiis while pulling the node component from aws codeartifact via docker file. What you need to do is create a .nmprc file and drop it root location fo the npm installaiton, doing this your issue will get addressed. I was getting below exception while ruinnig npm install in docker file something like
Run powershell -command npm install or any anglar cli install via npm
"8 : RUN powershell -Command npm install
2022-03-03T19:16:34.2653417Z ---> Running in 97791ba93799
2022-03-03T19:16:44.2652033Z [91mError: Failed to replace env in config: ${env:CODEARTIFACT_AUTH_TOKEN}
2022-03-03T19:16:44.2652033Z at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:415:13
2022-03-03T19:16:44.2661894Z at String.replace ()
2022-03-03T19:16:44.2661894Z at envReplace (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:411:12)
2022-03-03T19:16:44.2661894Z at parseField (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:389:7)
2022-03-03T19:16:44.2661894Z at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:330:24
2022-03-03T19:16:44.2661894Z at Array.forEach ()
2022-03-03T19:16:44.2661894Z at Conf.add (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:328:23)"
Solution
please use this docker file, I was passing token from build file something like
Build.ps1
$env:CODEARTIFACT_AUTH_TOKEN = aws codeartifact get-authorization-token --domain se2codepkg --domain-owner 590427636078 --query authorizationToken --output text
docker.ps1
Run powershell echo "registry=https://se2codepkg-590427636078.d.codeartifact.us-east-1.amazonaws.com/npm/npm-store/
//se2codepkg-590427636078.d.codeartifact.us-east-1.amazonaws.com/npm/npm-store/:always-auth=true
//se2codepkg-590427636078.d.codeartifact.us-east-1.amazonaws.com/npm/npm-store/:_authToken=${env:CODEARTIFACT_AUTH_TOKEN}">.npmrc
I got the idea by going through below link
https://developpaper.com/question/after-nodejs-is-installed-successfully-npm-cannot-run-and-prompt-failed-to-replace-env-in-config/
I'm trying to debug node application, I'm using IntelliJ IDEA 14.0.5 and nodejs 6.10.2. The app configuration seems to be ok, actually the application is running but when I try to debug the application I'm facing this error :
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.5\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=60858 --nolazy server.js
Debugger listening on [::]:60858
{ Error: ENOENT: no such file or directory, open 'c:\My\Project\Working\Folder\myapp\internal\streams\lazy_transform.js'
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at eval (eval at <anonymous> (internal/streams/lazy_transform.js:1:1), <anonymous>:49:17)
at eval (eval at <anonymous> (internal/streams/lazy_transform.js:1:1), <anonymous>:73:5)
at internal/streams/lazy_transform.js:1:1
at ContextifyScript.Script.runInThisContext (vm.js:25:33)
at runInThisContext (bootstrap_node.js:404:19)
at NativeModule.compile (bootstrap_node.js:491:18)
at NativeModule.require (bootstrap_node.js:437:18)
at crypto.js:24:23
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'c:\\\My\\Project\\Working\\Folder\\myapp\\internal\\streams\\lazy_transform.js' }
And other internals: child_process.js, socket_list.js and cluster.js
Could be something related to wrong debugger version ?
Missing some configuration ?
Thank you in advice,
Andrea
Node 6.* debugging is only supported since Idea 2016.2. V8 debugging protocol has changed dramatically since the time Idea 14 was released.
You have to either upgrade Idea or downgrade Node.js... to v 4.* may be, or even to 0.10
whenever I am starting my Node app it's giving following error.
Error: Failed to replace env in config: ${NPM_TOKEN}
at /usr/local/lib/node_modules/npm/lib/config/core.js:429:13
at String.replace (native)
at envReplace (/usr/local/lib/node_modules/npm/lib/config/core.js:424:12)
at parseField (/usr/local/lib/node_modules/npm/lib/config/core.js:400:7)
at /usr/local/lib/node_modules/npm/lib/config/core.js:338:17
at Array.forEach (native)
at Conf.add (/usr/local/lib/node_modules/npm/lib/config/core.js:337:23)
at ConfigChain.addString (/usr/local/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:325:10)
at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
/usr/local/lib/node_modules/npm/lib/npm.js:29
throw new Error('npm.load() required')
^
Error: npm.load() required
at Object.npm.config.get (/usr/local/lib/node_modules/npm/lib/npm.js:29:11)
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:58:40)
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:387:3)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:224:26)
Plz provide any solution. I totally stucked with this.Due to this issue I am unable to start my app and complete my work.
Temporary remove file .npmrc with your ${NPM_TOKEN}
Switch to proper node version ( with node version manager you can run like nvm use 12 )
export your environment variable "export NPM_TOKEN=yourvalue"
move back your .npmrc file and try to run your project again!
I'm trying to start a new project in React Native but I'm getting errors when I try to launch iOS Simulator. I have not edited the index.ios.js. I'm using iOS Simulator to run the project, and the error in the emulator is 'Could not connect to development server...'
Looking for JS files in /Users/jeff/Documents/TestApp
ERROR EACCES, permission denied '/Users/jeff/.babel.json'
{"errno":-13,"code":"EACCES","path":"/Users/jeff/.babel.json","syscall":"open"}
Error: EACCES, permission denied '/Users/jeff/.babel.json'
at Error (native)
at Object.fs.openSync (evalmachine.:500:18)
at Object.fs.writeFileSync (evalmachine.:1099:15)
at save (/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions. evalmachine.:565
fs.write = function(fd, buffer, offset, length, position, callback) {
^ Error: EACCES, permission denied '/Users/jeff/.babel.json'
at Error (native)
at Object.fs.openSync (evalmachine.:500:18)
at Object.fs.writeFileSync (evalmachine.:1099:15)
at process.save (/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19)
at process.emit (events.js:107:17)
at process.exit (node.js:600:17)
at process. (/Users/jeff/Documents/TestApp/node_modules/react-native/packager/packager.js:143:11)
at process.emit (events.js:107:17)
at process._fatalException (node.js:236:26) Process terminated. Press to close the window
I had fixed this problem, and execute the following command
sudo chmod 777 ~/.babel.json
and then re-init the react-native project, it will be successful.
You can try just
nvm alias default iojs-v2
If that doesn't work try going through all the steps in the installation guide again. Then in your project folder
rm -rf node_modules/
npm i
In Xcode remove RCTWebSocketDebugger from your libraries:
YourProject > Libraries > RCTWebSocketDebugger
Then in Xcode Product -> Clean and try building again
Giving the admin permissions to the path ~/.babel.json should help. Try with this command:
sudo chmod 777 ~/.babel.json
When I run jsonplaceholder I get:
jsonplaceholder
JSONPlaceholder listening on http://localhost:3000
fs.js:432
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'data.json'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at Object.index.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/node_modules/underscore.db/src/node.js:11:24)
at Function.low.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/lib/index.js:110:29)
at reset (/usr/local/lib/node_modules/jsonplaceholder/index.js:6:14)
at Server.<anonymous> (/usr/local/lib/node_modules/jsonplaceholder/index.js:14:3)
at Server.g (events.js:180:16)
at Server.EventEmitter.emit (events.js:92:17)
at net.js:1052:10
at process._tickCallback (node.js:415:13)
Im on Ubuntu 13.10
Project's author here. Just to let you know, finally, this (old) bug was fixed. Sorry for the inconvenience caused.
I'm still not sure if this has anything to do with an outdated module, or a messed up npm installation or maybe I'm just lucky, but basically the problem is that the path to access "data.json" is wrong (maybe not wrong but incomplete).
What I did was open file:
gksudo gedit /usr/local/lib/node_modules/jsonplaceholder/index.js
and modify the following function:
function reset() {
// server.low.load('data.json') <-- ORIGINAL LINE
server.low.load(require('path').resolve(__dirname, 'data.json')); //<--MY FIX
}
Just save the file, and run jsonplaceholder again.