npm install showing some error EACCESS - node.js

i recently reinstalled ubuntu os and installed npm and nodejs, but when i run npm install i am issues with EACCESS which i am unable to understand, anyhelp ?
i was googling it about this issue but still could not fix it from hours, even i was going through many posts in stackoverflow but none solved my issue, can anyone please let me y is it happening ?
npm install
> angular-seed#0.0.0 postinstall /home/sri/oxkey
> bower install
/home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:56
throw err;
^
Error: EACCES: permission denied, open '/home/sri/.config/configstore/bower-github.yml'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (evalmachine.<anonymous>:549:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
at Object.create.all.get (/home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/home/sri/oxkey/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/home/sri/oxkey/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/home/sri/oxkey/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
npm ERR! Linux 4.2.0-22-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! angular-seed#0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-seed#0.0.0 postinstall script 'bower install'.
npm ERR! This is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/sri/oxkey/npm-debug.log
heres my package.json file
may be there might be some silly mistakes, but really i am not able to get out of this.may i know why we will be getting this kind of errors actually ? Any help would be appreciated
{
"name": "angular-seed",
"private": true,
"version": "0.0.0",
"description": "A starter project for AngularJS",
"repository": "https://github.com/angular/angular-seed",
"license": "MIT",
"devDependencies": {
"bower": "^1.3.1",
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"http-server": "^0.6.1",
"jasmine-core": "^2.3.4",
"karma": "~0.12",
"karma-chrome-launcher": "^0.1.12",
"karma-firefox-launcher": "^0.1.6",
"karma-jasmine": "^0.3.5",
"karma-junit-reporter": "^0.2.2",
"protractor": "^2.1.0",
"shelljs": "^0.2.6"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "lr-http-server",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor.conf.js",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/##NG_LOADER_START##[\\s\\S]*\\/\\/##NG_LOADER_END##/, '//##NG_LOADER_START##\\n' + sed(/sourceMappingURL=angular-loader.min.js.map/,'sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map','app/bower_components/angular-loader/angular-loader.min.js') + '\\n//##NG_LOADER_END##', 'app/index-async.html');\""
}
}

Clean your npm cache:
npm cache clean
and run following command to grant access to specified directory
sudo chown -R $(whoami) ~/.config
After that you need to install it again from scratch and everything will work.

If just sudo-ing still fails with EACCESS, try:
sudo npm c get user
By doing this, I found out that when sudo-ed, the npm was using my orignal user ID (!) Using temporary configuration override user = 0 might be the easiest fix in this case. Beware not to use it for local installations, though!
This behavior of npm occurred to me after some system update (using Mac OS 10.13.6), but I'm unable to figure out, when exactly it happened.

You have to be root. Try:
sudo npm install
and then type your root password

Related

Could not resolve dependency with sanity in nextjs app

I am trying to deploy my next.js project, but I keep getting the following error with everything I do:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: rcd_drone#0.1.0
npm ERR! Found: #sanity/client#3.4.1
npm ERR! node_modules/#sanity/client
npm ERR! #sanity/client#"^3.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #sanity/client#"^2.11.0" from next-sanity-image#3.2.1
npm ERR! node_modules/next-sanity-image
npm ERR! next-sanity-image#"^3.2.1" 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.
I also have the following dependencies:
{
"name": "rcd_drone",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#babel/core": "^7.17.9",
"#sanity/client": "^3.2.0",
"#sanity/image-url": "^1.0.1",
"#stripe/stripe-js": "^1.25.0",
"canvas-confetti": "^1.5.1",
"next": "^12.1.0",
"next-sanity-image": "^3.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hot-toast": "^2.2.0",
"react-icons": "^4.3.1",
"frontmatter-markdown-loader": "^3.6.3",
"stripe": "^8.209.0"
},
"devDependencies": {
"#babel/preset-react": "^7.16.7",
"eslint": "8.13.0",
"eslint-config-next": "12.1.4"
}
}
Try doing the npm install --legacy-peer-deps within the Vercel project deploy page.
When deploying your project, go to the "build and output" settings, then in the npm command input write: npm install --legacy-peer-deps.
Select the override radio button, then try deploying.
Try deleting node_modules folder and package-lock.json file and run:
npm install --legacy-peer-deps
This is going to make fresh installation of the modules.

How do I solve npm install issue after deleting node_modules

I am trying to clean out my react-native project's package to do a clean npm install on a MacOS based system (my windows system for Android development has no issues in cleaning up package versions).
I started seeing errors in the npm instals complaining version differences betwces are not compatible and list differences between versions of each package in "rook project" and node_modules/ directory.
I do the usual fix by removing package-lock.json, delete the node_modules directory and re-run npm install. from my project folder. It immediately made the same error complaints. The problem is this, there is no node_modules in my project folder as I deleted it. And it did not create a new node_modules directory.
Given this issue, how do I debug this and fix it? Questions I'd like to find out:
how do I tell npm to tell me what it thinks root project value is (full path)?
How to tell npm to tell me where the full path to the node_modules directory it seems to see?
Finally, how do I force npm to do the right thing and focus my my project's collaterals and not look outside the project folder as it appears to be doing?
Some of my thoughts. I don't understand why it is making a package cersion comparison between root project and node_modules?
Seems that nodde and npm are doing different things in MacOS environment than in my windows system environment -- I don't understand this.
Anyone here can help me understand what is going on and how to solve it?
The Error output here:
thomas#Presonus americanaradio % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: AmericanaRadio#0.0.2
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#"^16.8" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" from the
root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.2" from react-native#0.66.4
npm ERR! node_modules/react-native
npm ERR! react-native#"^0.66.3" from the root project
npm ERR! peer react-native#">=0.59" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" 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/thomas/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/thomas/.npm/_logs/2021-12-10T15_47_02_669Z-debug.log
thomas#Presonus americanaradio %
The package.json content here:
{END)
"name": "AmericanaRadio",
"version": "0.0.2",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/checkbox": "^0.5.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/slider": "^3.0.3",
"node-fetch": "^2.6.1",
"react": "^16.13.1",
"react-native": "^0.66.3",
"react-native-background-timer": "^2.4.1",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "^1.9.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.15.2",
"react-native-simple-survey": "^3.1.2",
"react-native-swift": "^1.2.1",
"react-native-vector-icons": "^8.0.0",
"react-native-version-check": "^3.4.2",
"react-native-version-info": "^1.1.0",
"react-native-webview": "^11.3.1",
"react-navigation": "^4.4.3",
"react-navigation-drawer": "^2.6.0",
"react-navigation-stack": "^2.10.2",
"react-usestateref": "^1.0.8",
"socket.io-client": "^4.4.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.18.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
~
(END)
As noted in my description, the node_modules directory was deleted and running npm install failed and did not create a nodes_modules directory. So the error messages are confusing as I have no packages in my project directory (americanaradio).
Thank you for taking a look at this and hopefully a solution can come out of ths.
First check what library is giving you an error and try to reinstall or update that version . Try deleting node modules also . Then do npm install.

'.' is not recognized as an internal or external command (when running npm install for firebaseUI)

I cannot install npm packages on my firebaseUI demo application.
I cloned the master branch on github and am simply trying to run "npm install" but I am getting an error I have never come across with node package manager. I get
'.' is not recognized as an internal or external command
I also tried this will cygwin64 and had the exact same result. below is the error, and below that is my package.json
firebaseui#3.3.0 generate-test-files C:\repos\Firebase Demos\firebaseui-web
> ./buildtools/generate_test_files.sh
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firebaseui#3.3.0 generate-test-files: `./buildtools/generate_test_files.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firebaseui#3.3.0 generate-test-files 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\adam\AppData\Roaming\npm-cache\_logs\2018-08-18T01_43_27_526Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firebaseui#3.3.0 test: `npm run build && npm run generate-test-files && ./buildtools/run_tests.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firebaseui#3.3.0 test 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\adam\AppData\Roaming\npm-cache\_logs\2018-08-18T01_43_27_547Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firebaseui#3.3.0 prepublish: `npm run test && cp -r dist demo/public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firebaseui#3.3.0 prepublish 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\adam\AppData\Roaming\npm-cache\_logs\2018-08-18T01_43_27_577Z-debug.log
package.json
{
"name": "firebaseui",
"version": "3.3.0",
"description": "Javascript library for customizable UI on top of Firebase SDK",
"files": [
"dist/firebaseui.js",
"dist/firebaseui.css",
"dist/npm.js",
"dist/index.d.ts",
"dist/externs",
"LICENSE",
"README.md",
"package.json"
],
"main": "./dist/npm.js",
"types": "./dist/index.d.ts",
"style": "dist/firebaseui.css",
"scripts": {
"build": "gulp",
"build-all": "gulp build-all",
"build-soy": "gulp build-soy",
"demo": "npm run build && ./buildtools/run_demo.sh",
"test": "npm run build && npm run generate-test-files && ./buildtools/run_tests.sh",
"serve": "npm run build && npm run generate-test-files && gulp serve",
"generate-test-files": "./buildtools/generate_test_files.sh",
"prepublish": "npm run test && cp -r dist demo/public"
},
"test": "npm run test",
"author": "Google",
"repository": {
"type": "git",
"url": "https://github.com/firebase/firebaseui-web.git"
},
"license": "Apache-2.0",
"devDependencies": {
"closure-builder": "^2.2.34",
"firebase": "^5.0.0",
"firebase-tools": "^4.0.1",
"fs-extra": "^3.0.1",
"google-closure-compiler": "^20171112.0.0",
"google-closure-library": "^20171112.0.0",
"google-closure-templates": "^20150410.0.0",
"gulp": "^4.0.0",
"gulp-clean-css": "^2.0.12",
"gulp-closure-compiler": "^0.4.0",
"gulp-concat-css": "^3.1.0",
"gulp-connect": "^5.5.0",
"gulp-css-flip": "^0.4.0",
"gulp-css-inline-images": "^0.1.1",
"gulp-sass": "^2.3.2",
"gulp-util": "^3.0.7",
"material-design-lite": "^1.2.0",
"protractor": "^5.3.2",
"streamqueue": "^1.1.1"
},
"dependencies": {
"dialog-polyfill": "^0.4.7"
},
"peerDependencies": {
"firebase": ">=5.0.0"
}
}
Although this question is old I ran into the same problem when I was collaborating with another developer using another OS (Linux x Windows).
At the beginning of the project a script .sh was failing depending on the OS. We had to constantly modify the json file after merging some branch.
The solution we came up with was to append the shell being used to call the script, e.g. we changed the initialization script to
...
{
start: bash ./myscript && npm run start
}
...
It works fine on Linux and on Gitbash on Windows.
> ./buildtools/generate_test_files.sh
here just leave out dot-slash(./)
Though, if you wanted to, you could use .\\ (since single '\' would skip the next character) and it would work.

react-scripts: not found on create-react-app project on ubuntu?

I am working on reactjs using this one
https://github.com/facebookincubator/create-react-app
But when i deploy it to digitalocean on top of ubuntu 16
I can not run npm run build and got this as an error.
deploy#xxxx:/www/tmdb_admin$ sudo npm run build
[sudo] password for deploy:
> tmdb_admin#0.1.0 build /www/tmdb_admin
> react-scripts build
sh: 1: react-scripts: not found
npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v7.3.0
npm ERR! npm v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! tmdb_admin#0.1.0 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the tmdb_admin#0.1.0 build script 'react-scripts build'.
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 tmdb_admin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs tmdb_admin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls tmdb_admin
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /www/tmdb_admin/npm-debug.log
So this is my package.json file.
{
"name": "tmdb_admin",
"version": "0.1.0",
"private": true,
"devDependencies": {
"autoprefixer-stylus": "0.10.0",
"concurrently": "3.0.0",
"react-scripts": "0.6.1",
"stylus": "0.54.5"
},
"dependencies": {
"bulma": "^0.2.3",
"case-sensitive-paths-webpack-plugin": "^1.1.4",
"es6-promise": "^4.0.5",
"font-awesome": "^4.7.0",
"isomorphic-fetch": "^2.2.1",
"jwt-simple": "^0.5.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-pagify": "^2.1.1",
"react-redux": "^4.4.5",
"react-router": "^2.4.0",
"react-router-redux": "^4.0.4",
"react-slick": "^0.14.5",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
"segmentize": "^0.4.1",
"slick-carousel": "^1.6.0"
},
"scripts": {
"start": "react-scripts start",
"watch": "concurrently --names 'webpack, stylus' --prefix name 'npm run start' 'npm run styles:watch'",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"styles": "stylus -u autoprefixer-stylus ./src/css/style.styl -o ./src/css/style.css",
"styles:watch": "stylus -u autoprefixer-stylus -w ./src/css/style.styl -o ./src/css/style.css"
}
}
And this is my node and npm version.
deploy#xxxx:~$ node -v
v7.3.0
deploy#xxxx:~$ npm -v
4.0.5
How can i fix this and make npm run build works?
Thanks!
I had the same problem today and I fixed it running install again.
All that you need to do is rum again the command npm install into your project so you'll be able to run npm start comand again!
Works for me!
I hope I've Helped!
When you copy a generated create-react-app project to another directory (i.e. when it was deployed to the server), it failed because symlinks were not preserved. See https://github.com/facebookincubator/create-react-app/issues/200. The file react-scripts in ./node_modules/.bin/ needs to be symlinked to ./node_modules/react-scripts/bin/react-scripts.js. Using diff will not show the differences since the symlinks will be resolved.
Easiest solution is to create a temporary react project on the server (i.e. on the Digitalocean) and then copy the content of the ./node_modules/.bin using copy -a (and not copy -r, in order to preserve symlinks).
$ create-react-app tempReact
$ cp -a tempReact/node_modules/.bin/* myActualReactApp/node_modules/.bin
Another solution is to manually re-create the symlinks.
$ ln -s myActualreactApp/node_modules/react-scripts/bin/react-scripts.js myActualReactApp/node_modules/.bin/react-scripts
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM and NodeJS are installed globally with sudo and the owner of that files is the root and usually a user can only read/execute that packages. When NPM is stalled a ~/.npm/ folder is created by the root. By running create-react-app you are executing the command as user and create-react-app is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo privileges.
Often similar thing happens when you install NPM package with sudo e.g. sudo npm install --save. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo infrnt of NPM you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER
Source: create-react-app fails with permission denied

npm install Errors on mac 10.7.5

I am learning mongodb and as part of my learning process, I installed mongodb, nodejs and npm. When I execute the instruction npm install, this is the error I get:
me$ npm install
npm WARN package.json # No repository field.
npm ERR! Darwin 11.4.2
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! version not found: mongodb#3.2.1
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/Sites/mongodb/chapter1/npm-debug.log
This is the package.json:
{
"scripts": {
"test": "gulp test",
"watch": "gulp watch"
},
"dependencies": {
"async": "0.9.0",
"mongodb": "3.2.1"
},
"devDependencies": {
"gulp": "3.8.11",
"gulp-mocha": "2.0.1",
"mocha": "2.2.4"
}
}
I created a database called mongodb so it can see it but, I don't know what is wrong. I read the npm install errors" but nothing points to the similar error so I can solve it myself. Please, help !!
npm ERR! version not found: mongodb#3.2.1
It means the version 3.2.1 of the mongodb package doesn't exist (see https://www.npmjs.com/package/mongodb - currently, last version in 2.1.4).
Just fix the version number in your package.json from:
"dependencies": {
"async": "0.9.0",
"mongodb": "3.2.1"
},
to
"dependencies": {
"async": "0.9.0",
"mongodb": "^2.1.4"
},
Then re-run npm install

Resources