Failed installing Nuxt.js - vue.js

Hi I'm trying to create a Nuxt project using npx and this is what I get:
$ npx create-nuxt-app nuxt-prop
Error: EPERM: operation not permitted, mkdir 'C:\Users\Faturachman'
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 (<anonymous>)
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-nuxt-app#latest failed with code 7
Can anyone help me what's wrong? I can't seem to find the solution anywhere :/

the problem would be seem because of spacing in the username, so i managed to fix it by running cmd as administrator and
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
change the spacing with "~1"

Related

NPM install and upgrade throws Couldn't find package error when used in monorepo

Recently my shared monorepo package is not being resolved properly is is being treated as npm package not a monorepo package causing an error.
$ yarn install
yarn install v1.19.1
[1/4] Resolving packages...
error Couldn't find package "#placeholderName/common#^1.0.307" required by "#placeholderName/browser#1.0.307" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "#placeholderName/common#^1.0.307" required by "#placeholderName/server#1.0.307" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:721:66)
at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:750:123)
at PackageRequest.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:36539:17)
at Generator.throw (<anonymous>)
at step (C:\Program Files (x86)\Yarn\lib\cli.js:304:30)
at C:\Program Files (x86)\Yarn\lib\cli.js:317:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Im unsure of how to get rid of this annoying error and I've been trying for a while

Why "Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'", but it's there?

This is driving me nuts!
I have an NPM module that I successfully build in my Jenkins pipeline in a Windows node. Then later on in my pipeline, I execute another task, and get Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'. So for the hell of it I try to install grunt-cli and grunt again before I execute my task and see this.
00:10:42.733 + npm install -g grunt-cli
00:10:49.273 npm ERR! code EEXIST
00:10:49.273 npm ERR! path C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt
00:10:49.273 npm ERR! dest C:\Program Files\nodejs\grunt
00:10:49.273 npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt' -> 'C:\Program Files\nodejs\grunt'
00:10:49.273 npm ERR! File exists: C:\Program Files\nodejs\grunt
00:10:49.273 npm ERR! Remove the existing file and try again, or run npm
00:10:49.273 npm ERR! with --force to overwrite files recklessly.
00:10:49.273
00:10:49.273 npm ERR! A complete log of this run can be found in:
00:10:49.273 npm ERR! C:\Users\vagrant\AppData\Roaming\npm-cache\_logs\2022-03-09T03_53_47_072Z-debug.log
00:10:49.279 [Pipeline] echo
00:10:49.280 WARNING: grunt-cli is already installed!
00:10:49.283 [Pipeline] sh
00:10:49.555 + grunt print-artifact-name -q
00:10:49.556 internal/modules/cjs/loader.js:883
00:10:49.556 throw err;
00:10:49.556 ^
00:10:49.556
00:10:49.556 Error: Cannot find module 'C:\Program Files\nodejs\node_modules\grunt-cli\bin\grunt'
00:10:49.556 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
00:10:49.556 at Function.Module._load (internal/modules/cjs/loader.js:725:27)
00:10:49.556 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
00:10:49.556 at internal/main/run_main_module.js:17:47 {
00:10:49.556 code: 'MODULE_NOT_FOUND',
00:10:49.556 requireStack: []
00:10:49.556 }
What's going on? How can I solve this?

Keystone JS (generator-keystone) npm install fails

I have installed Keystone with Yeoman Generator.
yo keystone command runs without errors, but the following npm install finishes with error:
npm ERR! Unexpected end of JSON input while parsing near '...6.4","react":"^16.8.6'
Data from debug log
2317 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...6.4","react":"^16.8.6'
2317 verbose stack at JSON.parse (<anonymous>)
2317 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2317 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2317 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
How can I fix that?

Error installing create react app with code 7

This type of error creeps up when I am trying to install create react app with command line .How can I fix this problem ?
C:\Users\Rohit Mishra>npx create-react-app my-app
Error: EPERM: operation not permitted, mkdir 'C:\Users\Rohit'
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 (<anonymous>)
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
The issue is occurring because you have space between your computer username.
You can resolve this by not installing your create-react-app package globally.
Use these commands :-
1. npm cache clean --force
2. npm install create-react-app --force
3. npm fund
4. npx create-react-app <app-name>

elm-make fails to compile when running with yarn on nixos

The elm project I'm working on with yarn on nixos I cannot get to compile. This project compiles successfully for my colleagues who are using macOS; perhaps the failure to compile on my machine is related to my using NixOS.
When I run $ yarn start I get the following terminal output:
$ yarn start
yarn start v0.20.3
$ webpack-dev-server --env dev
env dev
Project is running at http://0.0.0.0:3000/
webpack output is served from /
Content not from webpack is served from /home/matthew/backup/azara_work/platform/web/src
404s will fallback to /index.html
Running elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7766-1wq3nh5.xanii6yldi.js
and when I attempt to load the page at http://0.0.0.0:3000/ my browser console shows the following errors:
VM1496:1 Uncaught Error: Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
at eval (eval at ./src/App.elm (http://0.0.0.0:3000/index.js:4316:1), <anonymous>:1:7)
at Object../src/App.elm (http://0.0.0.0:3000/index.js:4316:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at eval (eval at ./src/index.js (http://0.0.0.0:3000/index.js:4324:1), <anonymous>:7:13)
at Object../src/index.js (http://0.0.0.0:3000/index.js:4324:1)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
at fn (http://0.0.0.0:3000/index.js:86:20)
at Object.0 (http://0.0.0.0:3000/index.js:4333:18)
at __webpack_require__ (http://0.0.0.0:3000/index.js:658:30)
and
./src/App.elm
Module build failed: Error: Compiler process exited with error Compilation failed
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
at ChildProcess.<anonymous> (/home/matthew/backup/azara_work/platform/web/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
# ./src/index.js 2:12-32
# multi (webpack)-dev-server/client?http://0.0.0.0:3000 webpack/hot/dev-server ./src/index.js
It appears that the problem may have something to do with elm-make, since that appears in both errors. My path finds elm-make at
$ which elm-make
/home/matthew/.nix-profile/bin/elm-make
which is a different location than the path at which the error reports it is trying to find elm-make
(/home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make). I am wondering if that might be related to the problem.
In the directory listed in the error, elm-make does appear to be present when listing via ls:
$ ls /home/matthew/backup/azara_work/platform/web/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/
elm elm-make elm-package elm-reactor elm-repl
However, when I try to run the command listed in yarn start's output, except replacing elm-make with the elm-make at this node-modules path, I get a 'No such file or directory' error.
$ ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make /home/matthew/backup/azara_work/platform/web/src/App.elm --yes --warn --debug --output /tmp/117814-7422-1p5ad15.q2uqqzd7vi.js
-bash: ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make: No such file or directory
Why might I get this 'No such file or directory' error when attempting to run this 'node-modules' elm-make when the executable is clearly visible when listing via ls?
Is the failure to compile due to the difference in path locations between my path's elm-make and the other one under 'node-modules'? Perhaps yarn is using the wrong one. If so, how can I set yarn to use the correct elm-make?
How might I get yarn start to successfully compile the project?
Advice is much appreciated; I've been stuck on this for a while.
I suggest you make elm installation optional (somehow) for NixOS. Usually easiest if you create a shell.nix that everyone uses and avoid depending on nix via npm at all.
The reason why elm-make doesn't exist is due to ELF interpreter, which is located at different place for NixOS.
Try ldd ./node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make
Quick fix would be to symlink all binaries in ls -la $(nix-build -A elmPackages.elm '<nixpkgs>')/bin to your cabal sandbox.