Trow error when trying to make new vue-cli webpack project - vue.js

I keep getting a throw error with permission denied when trying to make a new vue-cli webpack build. It worked last night, but now all of a sudden I get these errors. Anyone know how to fix this?
/usr/local/lib/node_modules/vue-cli/node_modules/rimraf/rimraf.js:312
throw er
^
Error: EACCES: permission denied, unlink

I was also getting this kind of error:
downloading template
/usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:313
throw er
^
Error: EACCES: permission denied, unlink '/home/apoorv/.vue-templates/webpack/.gitignore'
at Object.unlinkSync (fs.js:956:3)
at rimrafSync (/usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:306:17)
at /usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:342:5
at Array.forEach (<anonymous>)
at rmkidsSync (/usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:341:26)
at rmdirSync (/usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:334:7)
at rimrafSync (/usr/local/lib/node_modules/#vue/cli-init/node_modules/rimraf/rimraf.js:304:9)
at downloadAndGenerate (/usr/local/lib/node_modules/#vue/cli-init/node_modules/vue-cli/bin/vue-init:149:20)
at checkVersion (/usr/local/lib/node_modules/#vue/cli-init/node_modules/vue-cli/bin/vue-init:130:11)
at Request.request [as _callback] (/usr/local/lib/node_modules/#vue/cli-init/node_modules/vue-cli/lib/check-version.js:29:5)
at Request.self.callback (/usr/local/lib/node_modules/#vue/cli-init/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request.<anonymous> (/usr/local/lib/node_modules/#vue/cli-init/node_modules/request/request.js:1161:10)
at Request.emit (events.js:198:13)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/#vue/cli-init/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:286:20)
It seemed like I didn't have appropriate permissions to
/home/apoorv/.vue-templates/webpack/.gitignore
Following #Nathan Wailes' answer, I just changed the permissions and resolved my issue using:
chmod -R 777 /home/apoorv/.vue-templates/*

It looks like you're running this command on Linux; try using chown to give yourself permission to access all of those directories / files.
See also: GitHub - Bower - EACCES: permission denied

Related

Error on any command npm. Error on any command npm

TypeError: invalid options argument at optsArg (/node_modules/mkdirp/lib/opts-arg.js:13:11) at mkdirp (/node_modules/mkdirp/index.js:11:10) at inferOwner.then.owner (/usr/share/npm/node_modules/gentle-fs/lib/mkdir.js:14:5) Error: npm.load() required at Object.get (/usr/share/npm/lib/npm.js:59:13) at process.errorHandler (/usr/share/npm/lib/utils/error-handler.js:205:32) at process.emit (events.js:198:13) at emitPromiseRejectionWarnings (internal/process/promises.js:140:18) at process._tickCallback (internal/process/next_tick.js:69:34) /usr/share/npm/lib/npm.js:59 throw new Error(npm.load() required) ^ Error: npm.load() required at Object.get (/usr/share/npm/lib/npm.js:59:13) at process.errorHandler (/usr/share/npm/lib/utils/error-handler.js:205:32) at process.emit (events.js:198:13) at process._fatalException (internal/bootstrap/node.js:497:27)
What's going on here? I do not understand anything
clean ubuntu focal.
Deleted /node_modules and installed npm via nvm. Now it works.

Upgrading jhipster from v5.0.1 to the latest

I am running linux 18.04, installed java 8. I am struggling with upgrading the current version of jhipster (v5.0.1)to the latest. I have used, yo, yarn and npm but there is no success.
With npm I get an error below, with yo i get the [subsequent] error:
Using JHipster version installed globally Executing jhipster:upgradeOptions:
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
events.js:174
throw er; // Unhandled 'error' event
^
Error: ERROR! Current directory does not contain a JHipster project.
at Environment.error (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:157:40)
at module.exports.error (/usr/lib/node_modules/generator-jhipster/generators/generator-base.js:1981:18)
at module.exports.assertJHipsterProject (/usr/lib/node_modules/generator-jhipster/generators/upgrade/index.js:144:26)
at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:399:25)
at /usr/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:400:11)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
Emitted 'error' event at:
at Immediate.setImmediate (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:406:18)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
[subsequent]
? Generators to update (Press <space> to select, <a> to toggle all, <i> to invert selection)generator-jhipster
Unhandled rejection Error: EACCES: permission denied, open '/home/lelo/.npm/_cacache/index-v5/ad/54/831265f841b3fd278d23c4c96b06a32656a62c88fddaa7739f419602a04d'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lelo/.npm/_logs/2019-08-25T22_22_40_369Z-debug.log```
Despite any user type, I am not getting the expected output which is the upgraded version of jhipster. What could I be doing wrong?
Make sure you are in your application directory and have git installed.
Then execute jhipster upgrade.
You will probably have to solve some problems of the resulting merge arising during the update.
More info: https://www.jhipster.tech/upgrading-an-application/

NPM permission error installing modules for material design

So, I really want to get started using material design. I'm using their getting started guide (https://material.io/develop/web/docs/getting-started/). Everything worked until the part where I have to install the modules. There I got the error:
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/paul/Code/Material_Design_Test/Test4/node_modules/node-sass/build'
And then because of this the npm start command did not work either.
I've tried running it with sudo, same error. Tried to give me ownership of the folders, as sudo. Nothing worked.
you may run with sudo mode or else give the folder ownership with your user account and try to run it again
chown -R yourusername:yourusername directory

Unable to run NPM in MAC Terminal

Unable to run npm in mac, tried un-installing re-installing it. (Removed the NPM properly and re-installed it). But every time I am getting below error.
Error: EEXIST: file already exists, mkdir '/usr/local/bin/npm'
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:77:20
at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:196:13)
at process._fatalException (internal/process/execution.js:146:25)
When I type NPM, it should run, instead I am getting above error.
It appears to be related to user permissions. See this post: npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'. Are you running the npm command as root?

npm install error EACCES permission denied?

I have permission problem using npm.
When I write "npm install"
Error: EACCES: permission denied, mkdir '/ItsMe'
TypeError: Cannot read property 'get' of undefined
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:83:20
at cb (/usr/local/lib/node_modules/npm/lib/npm.js:215:22)
at /usr/local/lib/node_modules/npm/lib/npm.js:253:24
at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7
at Array.forEach (native)
at /usr/local/lib/node_modules/npm/lib/config/core.js:80:13
at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:178:20)
at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:235:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211
if (npm.config.get('json')) {
^
TypeError: Cannot read property 'get' of undefined
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17)
at emitOne (events.js:96:13)
at process.emit (events.js:191:7)
at process._fatalException (bootstrap_node.js:304:26)
With a "ls -l" I have rwx rights.
I don't understand what "Cannot read property 'get' of undefined" means.
I searched on the web and tried several things but it' doesn't work.
Could you help me ?
Thank you
Your npm install try to do an mkdir in a file you don't have access to. Try to give him the right by doing
sudo npm install
or doing it as a super user (I dont recomand that) You also asked what npm install do without argument. Well if ou don't specify a folder it creates the folder node_module (that is why it does an mkdir). If you don't precise a module it will install all the module from package.json. It can take morte time and you will have a lots of package you won't need but with that you will be sure to have the one you want.
You can choose the package you want if you exactly know wich one. ie :
npm install sax#latest
the latest mean it gonna search for the last existing package
ANd you can also install a package you downloaded yourself. ie :
npm install ./package.tgz