I'm trying to install Angular-CLI so I can use Ionic framework, however the installation keeps crashing and gives me an error as such.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2019-05-31T09_00_09_770Z-debug.log
I've tried installing it by writing
sudo npm install -g #angular-cli
I've also tried installing it though this method here:
Can't install angular-cli on Mac
I'm sorry, I'm fairly new to this so I'm unsure on what information I should be providing.
I've installed Node JS (10.16.0)
I've also just installed the Ionic Framework and Cordova, however whenever I try opening a project that I create through the terminal, it tells me that I need to install Angular-CLI and once I say yes to the installation, I receive the same errors as above.
My MacOSX is 10.14.5
EDIT:
I've assigned read and write permission to my current user login on my computer but I'm still getting errors. When I run Ionic lab in my terminal to open my project the terminal asks me if I want to install angular and I write Yes. Then I get these errors.
[ng] Could not find module "#angular-devkit/build-angular" from "/Users/me/project".
[ng] Error: Could not find module "#angular-devkit/build-angular" from "/Users/me/project".
[ng] at Object.resolve (/Users/me/project/node_modules/#angular-devkit/core/node/resolve.js:141:11)
[ng] at Observable.rxjs_1.Observable [as _subscribe] (/Users/me/project/node_modules/#angular-devkit/architect/src/architect-legacy.js:153:40)
[ng] at Observable._trySubscribe (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:44:25)
[ng] at Observable.subscribe (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:30:22)
[ng] at /Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:99:19
[ng] at new Promise (<anonymous>)
[ng] at Observable.toPromise (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:97:16)
[ng] at RunCommand.runSingleTarget (/Users/me/project/node_modules/#angular/cli/models/architect-command.js:161:86)
[ng] at RunCommand.runArchitectTarget (/Users/me/project/node_modules/#angular/cli/models/architect-command.js:201:35)
[ng] at RunCommand.run (/Users/me/project/node_modules/#angular/cli/commands/run-impl.js:14:25)
[ng] at RunCommand.validateAndRun (/Users/me/project/node_modules/#angular/cli/models/command.js:124:31)
[ng] at process._tickCallback (internal/process/next_tick.js:68:7)
[ng] at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
[ng] at startup (internal/bootstrap/node.js:283:19)
[ng] at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error
details.
If anybody here is running into the same issue as me, basically what I had done was I ran
sudo chown -R $(whoami) ~/.npm*
in my terminal and then I restarted me computer. Once I did that I essentially just created a new Project and everything was added from there (including Angular CLI)
Related
I'm trying to install the Highcharts export server on a new Azure VM that runs on Ubuntu 20.04. I've installed node.js and npm, and when I try to run the npm install command:
sudo npm install highcharts-export-server -g
I get the following error:
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64 -> /usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { [Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom']
errno: -13,
code: 'EACCES',
syscall: 'link',
path:
'/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64',
dest:
'/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt#2.1.14 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt#2.1.14 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/2021-10-21T15_49_48_318Z-debug.log
Here is a screenshot:
I've also tried installing PhantomJS seperately using this command:
sudo npm install -g phantomjs#2.1.1 --unsafe-perm
(See: Why can't I install phantomjs (Error: EACCES: permission denied)?)
That didn't help.
How can I get past this error and install highcharts on our VM?
Fixed by updating NPM and nodejs to latest versions
I want to create a new react native project. At first, I faced a problem when I ran npm install -g expo-cli and I solved it by installing nvm, then installing node and npm by nvm. When I ran expo init NewProject, I got this error.
Could you help me solving it, please?
Uncaught Error [Error: EACCES: permission denied, open
'/home/pgf/.expo/state.json.1309825572'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/pgf/.expo/state.json.1309825572'
}
I tried sudo expo init; I got this ✖ Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app. and it created a project. Bur when I ran the project with expo start I got this error
Uncaught Error [Error: EACCES: permission denied, open '/home/pgf/.expo/state.json.2684774492'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/pgf/.expo/state.json.2684774492'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pgf/.npm/_logs/2020-05-29T19_37_07_602Z-debug.log
and this error when I ran it with sudo expo start
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
Could you help me solving this?
For me, there was no need to run it with sudo, since I ran into permissions errors. I had to reinstall expo-cli globally without using sudo. After that in your project directory:
sudo rm -rf ~/.expo
npm run start
could anyone advise what I should do please?
My node and npm version as follows:
$ viviantekiMacBook-Air-2:~ Vivi1an$ node -v
v8.11.1
$ viviantekiMacBook-Air-2:~ Vivi1an$ npm -v
5.6.0
I tried to install Angular CLI by following the instructions on their website but I got an error after I typed in npm install -g #angular/cli
Error info as below:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Vivi1an/.npm/_logs/2018-04-02T09_00_20_531Z-debug.log
viviantekiMacBook-Air-2:~ Vivi1an$
I have downloaded node.js in a local folder to use Babel, not sure if this has anything to do with it?
Many thanks!
sudo npm install -g #angular/cli
i have the same problem I give way perhaps work with you
This is how to solve it. Run this command:
sudo chown -R $USER /usr/local/lib/node_modules
sudo means we are running this command as root, the system super user. This is because we don’t have permission to write to that folder, but root will be able to fix any permission. This command also means the system will ask for your password to confirm.
chown is the command we use to change the owner of a file or folder. We set the -R option to change the owner recursively, so we also get owner access to all the files already contained in there.
$USER is an environment variable automatically set to your username.
And the final piece is the folder path.
Running this path will make the folder yours, so you can safely run your npm install -g commands!
i go with the previous answer i put it and i install angular well,
but i appear for me another maybe also related with
npm audit
for resolve, it follows this question link answer
how to fix the npm audit report
i hope is a benefit for you
I've provisioned a default clean node.js app via Elastic Beanstalk, and have a node.js script trying to run npm install inside the project directory (/var/app/current/deploy-dist), however, the following permission error is thrown:
npm WARN locking Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking /tmp/.npm/_locks/staging-f212e8d64a01707f.lock failed { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking syscall: 'open',
npm WARN locking path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm WARN deploy-dist No description
npm WARN deploy-dist No repository field.
npm WARN deploy-dist No license field.
npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path /tmp/.npm/_locks/staging-f212e8d64a01707f.lock
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/deploy-dist/npm-debug.log
The package.json is just a:
{
"dependencies": {
"node-fetch": "^1.3.3"
}
}
Running npm install with sudo obviously works, but is preferred to be avoided as a solution.
Setting NPM_CONFIG_PREFIX to a directory at ~ as per npm docs suggestion didn't work either, and the problem persists.
I suspect the problem lies in incorrect permissions for /tmp/.npm, which are
drwxr-xr-x 114 root root 4.0K Dec 27 17:04 .npm
This is confusing, as I expected a simple npm install to work out of the box.
UPDATE: Should not that the project directory already contains a node_modules folder, but even removing it and running npm install doesn't fix it.
I had this problem! You can use ebextensions to create a post-deploy script that changes the permissions of the tmp/npm/.locks folder.
In your node.js project, create a .ebextensions folder if you haven't got one already. Then, add a new config file, e.g. 00_create_postdeploy_script.config, with the following yaml:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_fix_node_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
When you deploy, this will create a script in /opt/elasticbeanstalk/hooks/appdeploy/post called 99_fix_node_permissions.sh, which looks like this:
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
Because it's in that post folder, it will be run automatically after your app has deployed -- and hence change the permissions as required.
EDIT: If you're having trouble with the permissions of the whole .npm folder, then you should change the last line of the config file to:
chown -R nodejs:nodejs /tmp/.npm/
I have had this problem in past and in my case cleaning the cache fixed my issue.
Please try this
npm cache clean
Hope it helps.
The following command will fix the issue. it worked for me.
sudo chown -R 1000:1000 "/home/user/.npm"
I have been trying to use react native and create a project but have not been able to do so.
I am using the instructions from https://facebook.github.io/react-native/docs/getting-started.html
Node and watchman are already installed and then when I enter:
npm install -g react-native-cli
I get this:
/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js
react-native-cli#1.0.0 /usr/local/lib/node_modules/react-native-cli
├── semver#5.3.0
├── minimist#1.2.0
├── chalk#1.1.3 (ansi-styles#2.2.1, escape-string-regexp#1.0.5, supports-color#2.0.0, has-ansi#2.0.0, strip-ansi#3.0.1)
└── prompt#0.2.14 (revalidator#0.1.8, pkginfo#0.4.0, read#1.0.7, winston#0.8.3, utile#0.2.1)
When I try to do:
react-native init AwesomeProject
I get:
This will walk you through creating a new React Native project in /Users/jaimito/AwesomeProject
Installing react-native package from npm...
npm WARN peerDependencies The peer dependency react#~15.2.1 included from react-native will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.4.0/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "react-native"
npm ERR! node v6.4.0
npm ERR! npm v2.15.9
npm ERR! path /Users/jaimito/.npm/optimist/0.6.1
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/jaimito/.npm/optimist/0.6.1'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, mkdir '/Users/jaimito/.npm/optimist/0.6.1'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/jaimito/.npm/optimist/0.6.1',
npm ERR! parent: 'react-native' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jaimito/AwesomeProject/npm-debug.log
`npm install --save --save-exact react-native` failed
How do I prevent the errors?
I am working on a Mac.
I used sudo at the beginning of the command. But when I did:
cd AwesomeProject
react-native run-ios
I got:
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/Users/jaimito/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at save (/Users/jaimito/AwesomeProject/node_modules/react-native/node_modules/babel-register/lib/cache.js:53:16)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I tried using sudo at the beginning and I got this:
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/Users/jaimito/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at save (/Users/jaimito/AwesomeProject/node_modules/react-native/node_modules/babel-register/lib/cache.js:53:16)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
~
Process terminated. Press <enter> to close the window
Try starting the command with sudo, it'll give your command the permission to create directories in the necessary places.
If you're on windows, try open the command line with admin permissions.
If you're on mac or linux, type sudo at the begining of the command.
Either way. Make sure your target directory doesn't already exist.
For me the marked directory inside the .npm directory belonged to root:wheel. Try to get it back ;) (or the 0.3.* directory inside marked)
chown -R `whoami` ~/.npm/marked
Or if necessary
sudo chown -R `whoami` ~/.npm/marked