npm加载包报错 :syscall access

 1 $ npm install --save-dev babel-plugin-syntax-dynamic-import
 2 npm WARN checkPermissions Missing write access to D:sword
eact1
1
ode_modulesfsevents
 3 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_moduleschokidar
ode_modulesfsevents):
 4 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
 5 
 6 npm ERR! path D:sword
eact1
1
ode_modulesfsevents
 7 npm ERR! code ENOENT
 8 npm ERR! errno -4058
 9 npm ERR! syscall access
10 npm ERR! enoent ENOENT: no such file or directory, access 'D:sword
eact1
1
ode_modulesfsevents'
11 npm ERR! enoent This is related to npm not being able to find a file.
12 npm ERR! enoent
13 
14 npm ERR! A complete log of this run can be found in:
15 npm ERR!     F:
odejs
ode_cache\_logs2017-10-30T04_43_57_804Z-debug.log
View Code

今天尝试打包react项目的时候 ,由于router4打包比较麻烦。在文档

https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/code-splitting.md

中提到使用babel-plugin-syntax-dynamic-import and react-loadable

但是在加载import插件的时候,报错syscall access ,github一查,发现是个偶尔出现但尚没有好的解决方案。。网友们要么回退版本要么用yarn。。。

我也是醉了

错误的大意是找不到module中的fsevents文件,但这就奇怪了,这个包的页面上并未提到有什么依赖关系,也不可能是我的node中文件丢失

后来发现改用cnpm加载就没问题...

前端有时候就是会遇到这类weird的问题。。。

原文地址:https://www.cnblogs.com/alan2kat/p/7754028.html