npm install 报错(npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path D: ode.jsodejs)

Posted 爱编程的小宁

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm install 报错(npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path D: ode.jsodejs)相关的知识,希望对你有一定的参考价值。

今天我正好要学习TS需要typeScript这个插件但是我用npm i typescript -g 这个命令安装的时候报错,我花了1个时才解决这个问题,下面我为大家提供一些解决方案

1.全部错误install

2.错误详解

 该错误发生在修改npm的全局安装路径之后,再执行npm install 包 -g或是npm install 包时发生,但是在管理员身份下运行cmd,均能执行成功(也不能一直用管理员模式吧很不方便)

我的原因应该是因为用了cnpm导致一些路径出错了

2.1修改npm全局安装

注意:在你的nodejs安装的目录里有(node_global,node_cache)这两个文件夹 执行这两个命令需要在管理员模式下打开cmd,运行这两个命令。

1.命令行

npm config set prefix "D:\\NodeJS\\node_global"

npm config set cache "D:\\NodeJS\\node_cache"

2.将上述node_global文件夹的路径加入环境变量

2.2 修复方法

1.可以删除C盘用户下的.npmc文件,这种解决方法虽然没有改变全局安装路径但是,但是本质问题没有解决还是会安装在C盘

2.每次都用管理员身份运行命令行(不够方便,vscode 下的命令行默认也不是管理员身份运行的)

3.然后修改node_global的权限

     1.鼠标右击node_global的文件夹,点开属性,再点击安全,再点击编辑,将权限都勾上即可。

 测试

npm i -g  typescript

结果

 结尾

希望大家可以解决这一问题!!!

npm install 报错(npm ERR! errno 1)

最好看错误提示,若缺少包文件,就依次安装

问题一

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall 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\xiant_000\AppData\Roaming\npm-cache\_logs\2019-09-14T23_49_41_121Z-debug.log

解决一

进入项目目录,运行命令:
npm install --save-dev postinstall
npm audit fix --force

问题二

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.2 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

解决二

进入项目目录,运行命令:
npm install --save-dev node-sass
npm audit fix --force
或
npm rebuild node-sass(未测试)

问题三

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sell@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sell@1.0.0 dev 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\xiant_000\AppData\Roaming\npm-cache\_logs\2019-09-15T00_18_31_634Z-debug.log

解决三

npm install --save-dev webpack
npm audit fix --force

以上是关于npm install 报错(npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path D: ode.jsodejs)的主要内容,如果未能解决你的问题,请参考以下文章

npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法

npm install 报错(npm ERR! errno 1)

输入npm install 报错npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: `no

npm install的时候报错 npm err code 1

npm install 报错:ERR! code EINTEGRITY 解决方案

npm install报错 npm ERR! enoent ENOENT: no such file or directory