node.js - npm install lite-server --save-dev 错误

标签 node.js windows npm npm-install lite-server

我第一次尝试在 Windows 的 VS 项目中使用 Node。我安装了node.js,以下是信息:

node -v 
v8.9.3
npm -v
5.5.1

使用 npm init 在项目中完成设置,看起来工作正常。

npm install lite-server --save-dev 产生以下错误:

$ npm install lite-server --save-dev
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

我不明白这些错误。帮助。谢谢!

最佳答案

错误来自于fsevents@1.1.3,它是lite-server的依赖包。

fsevents@1.1.3 仅适用于 macOS。查看其 npm info page .

Native access to OS X FSEvents in Node.js

The FSEvents API in OS X allows applications to register for notifications of changes to a given directory tree. It is a very fast and lightweight alternative to kqueue.

类似的问题也适用于具有此类依赖性的其他 npm 包。

<小时/>

我正在使用最新的稳定版本npm@5.6.0,并尝试在我的 Windows 上安装。该错误结果是一个警告,并让 lite-server 最终安装。无论如何,fsevents 只是一个可选的依赖项。

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\lite-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ lite-server@2.3.0
added 279 packages in 81.466s

关于node.js - npm install lite-server --save-dev 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48102046/

相关文章:

node.js - 如何将 fork 的 lerna 存储库的子包安装为 Node 依赖项?

npm - 如何安装react-admin的 `next`分支?

javascript - 我如何在 https 中启动 nwb?

node.js - 解构在 OSX 上有效,但在 Linux 上失败

php - 无法加载 php_curl

windows - 关于 127.0.0.1 和 IPC 使用套接字

windows - 从 Windows 批处理部分意外退出

node.js - Mongoose :检测插入的文档是否重复,如果是,则返回现有文档

node.js - winston 记录器退出错误: false still exits

javascript - 明确定义全局变量时出现 "globals is not defined"错误