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.
Related
After MacBook updated to v12.4 when I try to run yarn command on my react native project I get this error:
error /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents
Output:
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn node-gyp ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn node-gyp',
path: 'node-gyp',
This command was running fine yesterday and the only change would be Mac OS update.
Tried also running
rm -rf node_modules
yarn cache clean
yarn
and still got the same error
The error I got was when using node version 16.15.0
If I change the node version to 17.8.0 then I am able to run yarn with no issues.
I'm getting an error when I create a new Vue project using vue-cli. Each time the create fails on a "Socket timeout" but a different request? I updated node using nvm and installed the latest vue-cli.
Terminal shows this:
Vue CLI v4.5.9
✨ Creating project in /Users/me/Documents/GitHub/myproject.
🗃 Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2020-12-07T11_02_37_391Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps
The create tends to fail around the log file is around line 4900. These are the last lines in the log file:
4875 timing idealTree:node_modules/webpack-dev-server/node_modules/anymatch/node_modules/normalize-path Completed in 0ms
4876 timing idealTree:buildDeps Completed in 164233ms
4877 timing idealTree:fixDepFlags Completed in 10ms
4878 timing idealTree Completed in 164265ms
4879 timing command:install Completed in 164269ms
4880 verbose type system
4881 verbose stack FetchError: request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4881 verbose stack at ClientRequest.<anonymous> (/Users/me/.nvm/versions/node/v15.3.0/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
4881 verbose stack at ClientRequest.emit (node:events:376:20)
4881 verbose stack at TLSSocket.socketErrorListener (node:_http_client:490:9)
4881 verbose stack at TLSSocket.emit (node:events:388:22)
4881 verbose stack at emitErrorNT (node:internal/streams/destroy:188:8)
4881 verbose stack at emitErrorCloseNT (node:internal/streams/destroy:153:3)
4881 verbose stack at processTicksAndRejections (node:internal/process/task_queues:80:21)
4882 verbose cwd /Users/me/Documents/GitHub/myproject
4883 verbose Darwin 19.6.0
4884 verbose argv "/Users/me/.nvm/versions/node/v15.3.0/bin/node" "/Users/me/.nvm/versions/node/v15.3.0/bin/npm" "install" "--loglevel" "error" "--legacy-peer-deps"
4885 verbose node v15.3.0
4886 verbose npm v7.0.14
4887 error code ERR_SOCKET_TIMEOUT
4888 error errno ERR_SOCKET_TIMEOUT
4889 error request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4890 verbose exit 1
I ran into this as well. Fixed it by first running
vue config -e
Then setting this property to false:
{
"useTaobaoRegistry": false
}
Ok, I just updated my os to Big Sur and now it seems to work.
Updating to Big Sur did not help me.
This, however, helped:
sudo npm uninstall -g vue
sudo npm uninstall -g vue-cli
sudo npm uninstall -g #vue/cli
sudo npm cache clean --force
sudo npm install -g vue
sudo npm install -g #vue/cli
I'm trying to create react-app but I'm having a ENOENT problem, this is what the command prompt shows:
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
events.js:186
throw er; // Unhandled 'error' event
^
Error: spawn C:\Windows\system32\cmd.exe; ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\Pedro Fernando\AppData\Roaming\npm\node_modules\create-react-app\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn C:\\Windows\\system32\\cmd.exe;',
path: 'C:\\Windows\\system32\\cmd.exe;',
spawnargs: [
'/d',
'/s',
'/c',
'"npm ^"install^" ^"--save^" ^"--save-exact^" ^"--loglevel^" ^"error^" ^"react^" ^"react-dom^" ^"react-scripts#0.9.x^""'
]
}
Does anyone had this problem and was able to fix it?
Before anyone asks:
These are my system variables path
Windows System Variables Path
Please, try the following inside your terminal:
First remove all node_modules: rm -fr node_modules/
followed by:
npm install npm#latest -g
npm install -g create-react-app
npm init react-app my-app
Try to change react-scripts version to 2.1.8. This worked for me.
I've come across this issue a few times. Usually it's solved by restarting the computer.
I get the following error when installing Polymer CLI as follows
sudo npm install -g polymer-cli
29577 info lifecycle wd#1.5.0~install: wd#1.5.0
29578 verbose lifecycle wd#1.5.0~install: unsafe-perm in lifecycle false
29579 verbose lifecycle wd#1.5.0~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/lib/node_modules/polymer-cli/node_modules/wd/node_modules/.bin:/usr/lib/node_modules/polymer-cli/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/loc\
al/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
29580 verbose lifecycle wd#1.5.0~install: CWD: /usr/lib/node_modules/polymer-cli/node_modules/wd
29581 silly lifecycle wd#1.5.0~install: Args: [ '-c', 'node scripts/build-browser-scripts' ]
29582 silly lifecycle wd#1.5.0~install: Returned: code: 1 signal: null
29583 info lifecycle wd#1.5.0~install: Failed to exec install script
29584 verbose unlock done using /root/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
29585 verbose stack Error: wd#1.5.0 install: `node scripts/build-browser-scripts`
29585 verbose stack Exit status 1
29585 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
29585 verbose stack at EventEmitter.emit (events.js:160:13)
29585 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
29585 verbose stack at ChildProcess.emit (events.js:160:13)
29585 verbose stack at maybeClose (internal/child_process.js:943:16)
29585 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
29586 verbose pkgid wd#1.5.0
Any idea how to fix it?
UPDATE
I updated the npm and bower to the latest versions and then ran the install command again for polymer-cli. Now I get the following error message - it's a permissioning problem when running the script. I am not sure if this is down to the npm install script or if it is an arch linux problem.
sudo npm install -g polymer-cli
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated github#7.3.2: 'github' has been renamed to '#octokit/rest' (https://git.io/vNB11)
npm WARN deprecated #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
/usr/bin/polymer -> /usr/lib/node_modules/polymer-cli/bin/polymer.js
> uws#0.14.5 install /usr/lib/node_modules/polymer-cli/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
sh: build_log.txt: Permission denied
> wd#1.5.0 install /usr/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts
/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.fs.mkdirSync (fs.js:905:18)
at sync (/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:193:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd#1.5.0 install: `node scripts/build-browser-scripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd#1.5.0 install 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! /root/.npm/_logs/2018-01-28T19_51_38_197Z-debug.log
The issue now is when the script tries to make this directory:
mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
use --unsafe-perm option to install polymer-cli globally as described here
sudo npm install -g polymer-cli --unsafe-perm
or Change npm's Default Directory
and then install npm install -g polymer-cli without sudo and --unsafe-perm option.
Switched to Yarn and it installs!
sudo yarn global add polymer-cli
yarn global v1.3.2
[1/4] Resolving packages...
warning polymer-cli > babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
warning polymer-cli > bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
warning polymer-cli > github#7.3.2: 'github' has been renamed to '#octokit/rest' (https://git.io/vNB11)
warning polymer-cli > polyserve > #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "polymer-cli#1.5.7" with binaries:
- polymer
Done in 61.35s.
Webpack was working fine all day and when I added a new image it suddenly failed. I updated node and npm and I still get the following error. How would I go about fixing this or using an alternative? The other image loader modules I attempted to install give the same error.
74857 verbose stack Error: gifsicle#3.0.4 postinstall: `node lib/install.js`
74857 verbose stack Exit status 1
74857 verbose stack at EventEmitter.<anonymous> (C:\Users\mykod\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
74857 verbose stack at emitTwo (events.js:106:13)
74857 verbose stack at EventEmitter.emit (events.js:191:7)
74857 verbose stack at ChildProcess.<anonymous> (C:\Users\mykod\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
74857 verbose stack at emitTwo (events.js:106:13)
74857 verbose stack at ChildProcess.emit (events.js:191:7)
74857 verbose stack at maybeClose (internal/child_process.js:877:16)
74857 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
74858 verbose pkgid gifsicle#3.0.4
74859 verbose cwd C:\Users\mykod\Desktop\best-voted
74860 error Windows_NT 10.0.14393
74861 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mykod\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
74862 error node v6.9.4
74863 error npm v4.3.0
74864 error code ELIFECYCLE
74865 error errno 1
74866 error gifsicle#3.0.4 postinstall: `node lib/install.js`
74866 error Exit status 1
74867 error Failed at the gifsicle#3.0.4 postinstall script 'node lib/install.js'.
74867 error Make sure you have the latest version of node.js and npm installed.
74867 error If you do, this is most likely a problem with the gifsicle package,
74867 error not with npm itself.
74867 error Tell the author that this fails on your system:
74867 error node lib/install.js
74867 error You can get information on how to open an issue for this project with:
74867 error npm bugs gifsicle
74867 error Or if that isn't available, you can get their info via:
74867 error npm owner ls gifsicle
74867 error There is likely additional logging output above.
74868 verbose exit [ 1, true ]
Restarting doesn't help for me. There was problems with permissions on my laptop.
I'm working on Ubuntu 16.04.
Here is solution: fixing npm permissions
I'm recommending to watch video first.
At least check NPM's directory first npm config get prefix and if it's /usr, you have to use Option 2.
I've solved this problems with processing step by step of Option 2.
I restarted my computer and was able to install it. Windows.