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

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
[email protected] D:\front_end\vue-demo\demo2
`-- [email protected]
  +-- @vue/[email protected]
  | `-- [email protected]  deduped
  +-- [email protected]
  +-- [email protected]
  `-- [email protected]
    `-- [email protected]  deduped

npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@mrmlnc\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@sindresorhus\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@vue\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\front_end\vue-demo\demo2\node_modules\_@[email protected]@@webassemblyjs\package.json'
npm WARN [email protected] No description
npm WARN [email protected] 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

你可能感兴趣的:(npm)