我需要安装 react-hls-player npm 包来启动 m3u8 流,但是当我安装它时,它给了我这个错误。
我们的 npm 项目有一个 git 依赖项,它位于需要凭据的私有服务器上。项目和依赖项都由同一台服务器托管。
使用带有凭据的 git 依赖项会导致各种问题:身份验证错误、npm 将人们的用户名添加到中的 URLpackage.json
等。
为了尝试解决这个问题,我生成了一个只读访问令牌并将其作为密码嵌入到 URL 中。
{
"dependencies": {
"myPackage": "git+https://user:[email protected]`
...
}
...
}
```
这可以正常运行npm install
,但是它用wincred
访问令牌替换了我缓存的 git 凭据()!
有没有我可以在构建之前和之后运行的命令来说明以下内容:“请暂时不要缓存这些凭据,但也不要忘记缓存?”
我最近刚开始重新开始 Web 开发,我的电脑上已经安装了 Node.js。我试图运行npm install -g live-server
以使用 npm 的实时服务器。
这是我跑的时候返回的npm install -g live-server
。
ashle@DESKTOP-PFHHR2C MINGW64 ~/Desktop/npmtest
$ npm install -g live-server
npm WARN deprecated [email protected]: The package has been renamed to `open`
C:\Users\ashle\AppData\Roaming\npm\live-server -> C:\Users\ashle\AppData\Roaming\npm\node_modules\live-server\live-server.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\live-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
added 191 packages from 149 contributors in 22.221s
安装似乎工作正常;但是,当我运行时live-server
出现以下错误:
ashle@DESKTOP-PFHHR2C MINGW64 ~/Desktop/npmtest
$ live-server
Serving "C:\Users\ashle\Desktop\npmtest" at http://127.0.0.1:8080
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
我已经尝试使用此(https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows)作为指南从 Windows 中完全删除 Node.js;但是,一旦我再次安装节点和实时服务器,它仍然返回相同的错误。
我检查了路径以确保 C:\Users\Webmaster\AppData\Roaming\npm 在那里。也许那里出了问题,因为我不小心删除了所有其他环境变量,或者我完全没有注意到我做错了什么?还有其他人遇到过这个问题吗?
编辑:我也试过安装 gulp。然后当我尝试运行它时安装了所说的软件包,弹出了相同的消息,所以我不认为它是实时服务器独有的问题。
运行 npm install 时出错
C:\cygwin64\home\kjeeva\ANSYSDev\Licensing194\LicensingPortal\node_modules\strong-ursa>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\kjeeva\AppData\Local\Programs\Python\Python37-32\python.exe -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\cygwin64\home\kjeeva\ANSYSDev\Licensing194\LicensingPortal\node_modules\strong-ursa
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
我正在使用 Homebrew 在干净的 macOS Mojave 机器上安装节点。我正在尝试在用户拥有的目录中设置 npm 安装目录;该目录tools
已存在并归用户所有:
npm config set prefix '/Users/giorgio/tools/npm_global'
这条消息失败了。有谁知道发生了什么事?
Error: EACCES: permission denied, mkdir '/tools'
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:197:13)
at process._fatalException (internal/process/execution.js:123:25)