How to Fix "npm ERR! addLocal Could not install" - npm

I'm getting this error when attempting to push my Phoenix application to Heroku.
I've been following the guide from the Phoenix framework website.
What is causing this error and how can I fix it?
WARNING: phoenix_static_buildpack.config wasn't found in the app
remote: Using default config from Phoenix static buildpack
remote: Will use the following versions:
remote: * Node 6.9.2
remote: Will export the following config vars:
remote: * Config vars DATABASE_URL
remote: * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote: Downloading node 6.9.2...
remote: Installing Node 6.9.2...
remote: Using default npm version
remote:
remote: -----> Building dependencies
remote: Installing and caching node modules
remote: npm ERR! addLocal Could not install /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix
remote: npm ERR! addLocal Could not install /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix_html
remote: npm ERR! Linux 3.13.0-105-generic
remote: npm ERR! argv "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/.heroku/node/bin/node" "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/.heroku/node/bin/npm" "install" "--quiet" "--unsafe-perm" "--userconfig" "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/npmrc"
remote: npm ERR! node v6.9.2
remote: npm ERR! npm v3.10.9
remote: npm ERR! path /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote:
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix'
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix'
remote: npm ERR! enoent This is most likely not a problem with npm itself
remote: npm ERR! enoent and is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/npm-debug.log
remote: ! Push rejected, failed to compile Phoenix app.

I was having the same issue as you before. Try adding the npm version to the phoenix_static_buildpack.config file
Here's a sample from my app:
phoenix_static_buildpack.config (in the root)
clean_cache=false
compile="compile"
config_vars_to_export=(DATABASE_URL)
node_version=6.9.5
npm=3.10.8
phoenix_relative_path=.
remove_node=false
You can also set the
elixir_buildpack.config (also in the root directory)
erlang_version=18.3
elixir_version=1.4.0
always_rebuild=false
runtime_path=/app

Related

! [remote rejected] new-branch -> main (pre-receive hook declined) error: failed to push some refs to Heroku

I am running into an issue while trying to push up to Heroku. I can't seem to find a working solution. Please help. I have tried adding NPM and Node versions in my package.json as well as psuhing from a new branch -- new-branch:main.
Nothing seems to work. Help would be appreciated. Thanks in advance.
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 16.x
remote: engines.npm (package.json): 8.x
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.16.0...
remote: Bootstrapping npm 8.x (replacing 8.11.0)...
remote: npm 8.13.2 installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > openmenu#1.2.1 install
remote: > npm --prefix backend install backend && npm --prefix frontend install frontend
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_4492b4f5/backend/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_4492b4f5/backend/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.oFKZI/_logs/2022-07-08T01_43_06_983Z-debug-0.log
remote: npm ERR! code 254
remote: npm ERR! path /tmp/build_4492b4f5
remote: npm ERR! command failed
remote: npm ERR! command sh -c /tmp/install657244586683.sh
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.oFKZI/_logs/2022-07-08T01_43_04_790Z-debug-0.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to openmenu-live.
remote:
To https://git.heroku.com/openmenu-live.git
! [remote rejected] new-branch -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/openmenu-live.git'

I get an error creating a react-360 project

I get this error when I start a new react-360 project using react-360 init myProject.It creates the folder but when I npm start it gives me more errors.
react-360 init MyProject
(node:17583) ExperimentalWarning: The fs.promises API is experimental
Creating new React 360 project...
Project directory created at MyProject
Copying assets...
Installing dependencies...
(node:17584) ExperimentalWarning: The fs.promises API is experimental
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: MyProject#0.0.1
npm ERR! Found: react#16.3.2
npm ERR! node_modules/react
npm ERR! react#"16.3.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.3.1" from react-native#0.55.4
npm ERR! node_modules/react-native
npm ERR! react-native#"~0.55.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/scylla/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/scylla/.npm/_logs/2021-03-17T10_50_46_670Z-debug.log
`npm` exited with code 1. Try fixing the errors above and run `npm` from within MyProject again.
When I run npm start
npm start
(node:17675) ExperimentalWarning: The fs.promises API is experimental
> MyProject#0.0.1 start
> node node_modules/react-360/scripts/packager.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/Users/scylla/Documents/cs/react360test/MyProject/node_modules/react-360/scripts/packager.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
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:622:3)
Any Ideas on how to solve it? Thanks.
ok, I just ran npm install --force and it fixed everything!!

Gatsby new fails to install the sharp package and breaks

I can't initiate a gatsby starter project. The new command process breaks down during initialization, and results in an error and non-compilable project.
Here's the command:
> gatsby new gatsby-test
The follwing process starts, failing when during npm install when the sharp package is attempting to install.
info Creating new site from git:
Cloning into 'gatsby-test'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 2309 (delta 4), reused 10 (delta 4), pack-reused 2299
Receiving objects: 100% (2309/2309), 12.62 MiB | 7.98 MiB/s, done.
Resolving deltas: 100% (1487/1487), done.
success Created starter directory layout
info Installing packages...
> sharp#0.23.2 install /home/developer/projects/gatsby-test/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
fs.js:114
throw err;
^
Error: EACCES: permission denied, copyfile '/tmp/1890-libvips-8.8.1-linux-x64.tar.gz' -> '/home/developer/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz'
at Object.copyFileSync (fs.js:1728:3)
at WriteStream.<anonymous> (/home/developer/projects/gatsby-test/node_modules/sharp/install/libvips.js:104:16)
at WriteStream.emit (events.js:198:13)
at lazyFs.close (internal/fs/streams.js:207:14)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
make: Entering directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:0:
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
#include <glib-object.h>
^~~~~~~~~~~~~~~
compilation terminated.
sharp.target.mk:129: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.15.0-70-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/developer/projects/gatsby-test/node_modules/sharp
gyp ERR! node -v v10.17.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp#0.23.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp#0.23.2 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! /home/developer/.npm/_logs/2019-11-18T16_45_16_026Z-debug.log
ERROR
Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
- error.js:56 makeError
[lib]/[gatsby-cli]/[execa]/lib/error.js:56:11
- index.js:114 handlePromise
[lib]/[gatsby-cli]/[execa]/index.js:114:26
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
Any idea what's going on here? I saw there were some problems with sharp in the past but that is supposed to be a closed and fixed issue now. What am I missing here?
You can fix this by running the below in your terminal...
rm -rf /Users/{username}/.npm/_libvips
brew install vips
rm -rf node_modules
npm install
The following line:
Error: EACCES: permission denied, copyfile '/tmp/1890-libvips-8.8.1-linux-x64.tar.gz' -> '/home/developer/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz'
suggests you have a permissions error moving tmp file to your users local .npm directory. Hard to tell why this is without knowing more context about which user ran the command, etc.
The following line:
fatal error: glib-object.h: No such file or directory
suggests you don't have sharp or vips correctly installed.
npm install sharp
For Ubuntu:
sudo apt-get install -y libvips-tools
For mac:
brew update vips
For archlinux/manjaro:
sudo pacman -S libvips
I had the same issue. I solved it by downloading the package manually and pasting in
download the libvips from https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
copy the lib into .npm folder
sudo cp libvips-8.8.1-linux-x64.tar.gz /home/[YOURNAME]/.npm/_libvips/
remove your broken gatsby-test folder
run
gatsby new gatsby-test
again
To fix this, I ran:
rm -rf node_modules
yarn cache clean
yarn add --dev yarn-upgrade-all
npx yarn-upgrade-all
Then, I re-installed all necessary packages removed from package.json when I ran the command to upgrade all packages.
Afterwards, I ran gatsby build and gatsby develop
Try the sudo command. If you're happy with applying root perms to the install.

While pushing my commits to heroku, "code ETARGET notarget No matching version found for mongodb#0.7.9"

I built a localhost website on MacOS using Express, Mongodb. Now I want to deploy it to Heroku server. Here are the commands I used before running into an error
$ git add .
$ git commit -m"Some ms"
$ git push origin master
$ heroku create
$ git push heroku master
The error when I push to heroku is
Enumerating objects: 1695, done.
Counting objects: 100% (1695/1695), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1332/1332), done.
Writing objects: 100% (1695/1695), 5.41 MiB | 720.00 KiB/s, done.
Total 1695 (delta 330), reused 1420 (delta 288)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.16.2...
remote: Using default npm version: 6.9.0
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote: body-parser#1.19.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/body-parser
remote: bytes#3.1.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/bytes
remote: content-type#1.0.4 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/content-type
remote: debug#2.6.9 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/debug
remote: ms#2.0.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/ms
remote: depd#1.1.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/depd
remote: http-errors#1.7.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/http-errors
remote: inherits#2.0.3 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/inherits
remote: setprototypeof#1.1.1 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/setprototypeof
remote: statuses#1.5.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/statuses
remote: toidentifier#1.0.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/toidentifier
remote: iconv-lite#0.4.24 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/iconv-lite
remote: safer-buffer#2.1.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/safer-buffer
.....
remote: mongodb#2.2.36 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/mongodb
remote: mongodb-core#2.1.20 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/mongodb-core
remote: moongoose#0.0.5 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/moongoose
remote: ajv#4.11.8 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/moongoose/node_modules/ajv
remote: Installing any new modules (package.json)
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for mongodb#0.7.9
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote: npm ERR! notarget
remote: npm ERR! notarget It was specified as a dependency of 'mongoose'
remote: npm ERR! notarget
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.VeHSV/_logs/2019-08-09T16_20_21_378Z-debug.log
remote:
remote: -----> Build failed
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to hidden-savannah-22467.
remote:
To https://git.heroku.com/hidden-savannah-22467.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/hidden-savannah-22467.git'
I have tried $ npm cache clean --force, $ npm install and $ npm install mongoose --save and $ npm install mongodb --save and I got this error
npm ERR! code ETARGET
npm ERR! notarget No matching version found for mongodb#0.7.9
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'mongoose'
npm ERR! notarget
My package.json file is
{
"name": "yelp",
"version": "1.0.0",
"description": "Clone of Yelp",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"ejs": "^2.6.2",
"express": "^4.17.1",
"express-session": "^1.16.2",
"method-override": "^3.0.0",
"mongodb": "^3.3.0-beta2",
"mongoose": "0.0.5",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^5.0.1",
"request": "^2.88.0"
}
}
Can anyone help me installing mongoose and deploying to Heroku please?
I fixed this error by changing the version of mongoose from 0.0.5 to ^4.1.12 in package.json. I got the version 0.0.5 when I did $npm install mongoose --save in terminal. I wonder why I got such version when using that command?

Failed at the electron#1.8.2 postinstall script

I was trying to install electron into my project, but it is giving an error. I also tried to do this with unsafe-perm, but still giving the same error.
npm install electron --save-dev --save-exact
> electron#1.8.2 postinstall E:\PrgLang\Electron\crypto-app\node_modules\electron
> node install.js
Downloading electron-v1.8.2-win32-x64.zip
[============================================>] 100.0% of 55.21 MB (1.51 MB/s)
E:\PrgLang\Electron\crypto-app\node_modules\electron\install.js:47
throw err
^
Error: Could not parse checksum file at line 1:
at new ChecksumParseError (E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:71:127)
at E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:130:20
at Array.forEach (<anonymous>)
at E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:125:38
at new Promise (<anonymous>)
at ChecksumValidator.parseChecksumFile (E:\PrgLang\Electron\crypto-app\node_modules\sumchecker\build.js:121:14)
at <anonymous>
npm WARN crypto-app#1.0.0 No description
npm WARN crypto-app#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#1.8.2 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#1.8.2 postinstall 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! C:\Users\Harshit\AppData\Roaming\npm-cache\_logs\2018-02-11T03_33_52_399Z-debug.log
Can you please try(after removing node_modules)
sudo npm install electron --save-dev --save-exact --unsafe-perm=true --allow-root
I was running into the same error and this is what worked for me.
According to this GitHub issue it could potentially be solved with one of the following actions:
remove the node_modules folder and run npm install again
rename the SHASUM file in your user home directory's .electron folder
The postinstall script of Electron is downloading a binary from a non-npm domain (possibly github.com), for which the proxy may not be configured.