error command failed to execute ... npm install - npm

I followed http://www.phoenixframework.org/docs/installation to install Phoenix on a current Debian system but can't get it to work. When I want to create a new Phoenix application I get the following error:
abc#xyz:~$ mix phoenix.new test10
* creating test10/config/config.exs
[...]
* creating test10/web/views/page_view.ex
Fetch and install dependencies? [Yn] Y
* running npm install && node node_modules/brunch/bin/brunch build
* error command failed to execute, please run the following command
again after installation:
"npm install && node node_modules/brunch/bin/brunch build"
[...]
If I then run the npm install I get this:
abc#xyz:~/test10$ npm install
npm ERR! addLocal Could not install /home/abc/test10/deps/phoenix
npm ERR! addLocal Could not install /home/abc/test10/deps/phoenix_html
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/bin/nodejs" "/home/abc/.npm-global/bin/npm" "install"
npm ERR! node v6.5.0
npm ERR! npm v3.10.6
npm ERR! path /home/abc/test10/deps/phoenix
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory,
open '/home/abc/test10/deps/phoenix'
npm ERR! enoent ENOENT: no such file or directory,
open '/home/abc/test10/deps/phoenix'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /home/abc/test10/npm-debug.log
abc#xyz:~/test10$
What do I have to do to fix this?

Running mix deps.get did the trick:
abc#xyz:~/test10$ mix deps.get
Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? (if running non-interactively, use: "mix local.hex --force") [Yn] Y
* creating /home/abc/.mix/archives/hex-0.13.0
Running dependency resolution
Dependency resolution completed
connection: 1.0.4
[...]

Related

I am unable to install npm package

I have made an empty folder and trying to install the npm package inside the folder so I can start to write an application. I have been attempting to install package JSON with npm install -y but it only installs the package-lock-JSON but it's showing me the following error. I even reinstalled the node on my PC didn't work.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\hasan\Desktop\Githubfiles\node _express_mongodb/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\hasan\Desktop\Githubfiles\node _express_mongodb\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hasan\AppData\Local\npm-cache_logs\2022-12-06T12_18_28_964Z-debug-0.log
PS C:\Users\hasan\Desktop\Githubfiles\node _express_mongodb>

How to resolve npm error: npm start not working

i am trying to install "npx create-react-app new" it successfully installs, however "npm start" shows error:
PS D:\react project\new> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\react project\new/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\react project\new\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2022-03-15T08_51_51_601Z-debug.log
PS D:\react project\new>
I checked my package.json, it looks fine, anyone can suggest whats the issue here?
First of all run:
npm run start
if it did not work then delete the node-module folder and use
npm i or npm install
this will work for you.

React app: npm run build throws "sh: cross-env: command not found" even after running npm i

I have been unable to run the command npm run build unsuccessfully, I get the following issue:
> #myer-online/frontend#1.0.0 build /Users/surbhimidha/myer-online
> cross-env NODE_ENV=production next build
sh: cross-env: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! #myer-online/frontend#1.0.0 build: `cross-env NODE_ENV=production next build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #myer-online/frontend#1.0.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! /Users/surbhimidha/.npm/_logs/2021-02-10T08_06_42_019Z-debug.log
I am using the following versions of node and npm:
npm: 6.14.8
node: 14.13.1
I have tried to delete node modules and run npm i but still I get the above error when I run npm run build
I noticed that cross-env is not present under /node_modules/.bin
Please help!

npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/lib/node_modules/mdo-browser-support'

I am trying to install the latest mfpdev-cli version (8.0.2016062816) but I got the following error:
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "mfpdev-cli"
npm ERR! node v6.2.1
npm ERR! npm v3.9.3
npm ERR! path /usr/local/lib/node_modules/mdo-browser-support
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/lib/node_modules/mdo-browser-support'
npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/lib/node_modules/mdo-browser-support'
npm ERR! enoent
This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! anoint
Checking the repository, I was not able to find the mdo-* modules, this is the problem.
I also tried to install it through the .tar.gz file, but same error.
Is there a "workaround" on this issue?
Try :
sudo npm install -g mfpdev-cli#8.0.2016062416 --no-optional
Looks like newer builds have an issue.
Try to run the install with "sudo".
sudo npm install -g mfpdev-cli

ElectronJs: Not able to install "install.js:22 throw err"

I am starting with Electron js and I have stumbled on the very first step which is installed Electron.
I am running the following command to install electron provided at
source
npm install electron-prebuilt --save-dev
Following is the result of the command
C:\Users\vikas\Desktop\electron apps\example>npm install electron-prebuilt --sa
ve-dev
electron-prebuilt#0.37.8 postinstall C:\Users\vikas\Desktop\electron apps\exa
mple\node_modules\electron-prebuilt
node install.js
C:\Users\vikas\Desktop\electron apps\example\node_modules\electron-prebuilt\ins
tall.js:22
throw err
^
Error: end of central directory record signature not found
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:167:14
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:473:5
at C:\Users\vikas\Desktop\electron apps\example\node_modules\fd-slicer\inde
x.js:32:7
at FSReqWrap.wrapper as oncomplete
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\vikas\Desktop
\electron apps\example\package.json'
npm WARN example No description
npm WARN example No repository field.
npm WARN example No README data
npm WARN example No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\vikas\AppData\
\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron-prebuilt"
"--save-dev"
npm ERR! node v4.4.3
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.37.8 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.37.8 postinstall script 'node install
.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 electron-prebuilt pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\vikas\Desktop\electron apps\example\npm-debug.log
Windows 8.1
NPM Version 3.8.9
Does C:\Users\vikas\Desktop\electron apps\example\package.json exist? If not try running npm init to create it, and then run npm install electron-prebuilt --save-dev again.
this is bug and a workaround is provided on github : Source
Here is the workaround:
rm -rf ~/.electron/
rm -rf ~/.atom/
npm cache clear
npm install
I was facing a similar issue. But opening the command prompt as administrator (Windows) and reinstalling electron fixed the issue.