npm没有权限,显示no such file or directory

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/AHRL__/article/details/80303388

npm没有权限,显示no such file or directory

初学vue,在安装vue-loader时,真的是踩了个深坑,我觉得有必要记录一下。

当在命令行输入:

npm i vue-loader

报了下面一巴拉的错:

npm WARN checkPermissions Missing write access to D:\front_end\vue-demo\demo2\node_modules\hash-sum
npm WARN checkPermissions Missing write access to D:\front_end\vue-demo\demo2\node_modules\vue-hot-reload-api
npm WARN checkPermissions Missing write access to D:\front_end\vue-demo\demo2\node_modules\vue-style-loader
npm WARN checkPermissions Missing write access to D:\front_end\vue-demo\demo2\node_modules\vue-loader
demo2@1.0.0 D:\front_end\vue-demo\demo2
`-- vue-loader@15.0.10
  +-- @vue/component-compiler-utils@1.2.1
  | `-- hash-sum@1.0.2  deduped
  +-- hash-sum@1.0.2
  +-- vue-hot-reload-api@2.3.0
  `-- vue-style-loader@4.1.0
    `-- hash-sum@1.0.2  deduped

npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@mrmlnc_readdir-enhanced@2.2.1@@mrmlnc\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@sindresorhus_is@0.7.0@@sindresorhus\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_ast@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_floating-point-hex-parser@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@vue_component-compiler-utils@1.2.1@@vue\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_helper-buffer@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_helper-code-frame@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_helper-fsm@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_helper-wasm-bytecode@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_helper-wasm-section@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_leb128@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_validation@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wasm-edit@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wasm-gen@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wasm-opt@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wasm-parser@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wast-parser@1.4.3@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@webassemblyjs_wast-printer@1.4.3@@webassemblyjs\package.json'
npm WARN demo2@1.0.0 No description
npm WARN demo2@1.0.0 No repository field.
npm ERR! path D:\front_end\vue-demo\demo2\node_modules\hash-sum
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'D:\front_end\vue-demo\demo2\node_modules\hash-sum'
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

可以看见上述错误中有几个关键词:access、Permissions以及无数的no such file or directory。
根据程序员的英语素养猜测:大概就是没有权限,无法进入之类的。

解决办法:其实只要使用cnpm镜像就好了
安装cnpm:

npm install cnpm -g --registry=https://regestry.npm.taobao.org

最好在安装后重新开一次命令程序,然后使用下面指令重新install

cnpm i vue-loader
展开阅读全文

没有更多推荐了,返回首页