User@userAcc-Dummy:/$ sudo apt-get install npm require-in-the-middle
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package require-in-the-middle
多年来,我一直在 Windows 上使用http-server 。今天我在 ubuntu 上安装了 http-server,但它不起作用。它的初始化与在 Windows 上完全相同。但是,当我导航到本地网站 ( http://127.0.0.1:8080 ) 时出现错误。这在 Windows 上不会发生。知道如何解决这个问题吗?
clayton@u20:~/hello-pwa-master$ http-server
Starting up http-server, serving ./
http-server version: 14.0.0
http-server settings:
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none
Available on:
http://127.0.0.1:8080
http://192.168.4.54:8080
Hit CTRL-C to stop the server
[Sun Dec 12 2021 22:12:15 GMT-0700 (Mountain Standard Time)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
_http_outgoing.js:470
throw new ERR_HTTP_HEADERS_SENT('set');
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at module.exports.ResponseStream.(anonymous function) [as setHeader] (/usr/local/lib/node_modules/http-server/node_modules/union/lib/response-stream.js:100:34)
at Object.exports.(anonymous function) (/usr/local/lib/node_modules/http-server/lib/core/status-handlers.js:57:7)
at Readable.stream.on (/usr/local/lib/node_modules/http-server/lib/core/index.js:339:22)
at Readable.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
我netlify login
在终端中使用过,但它给出了错误 -
netlify: command not found
。我还使用此命令安装了 netlify CLI -
npm install netlify-cli -g
但仍然出现此错误。
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: "Please update to latest v2.3 or v2.2"
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli/node_modules/@netlify
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli/node_modules/chokidar/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/netlify-cli/node_modules/rollup/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/[email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/[email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/netlify-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @octokit/[email protected] requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/netlify-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/netlify-cli'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/netlify-cli']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/netlify-cli\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/netlify-cli' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rudrakshi/.npm/_logs/2021-01-22T05_32_03_765Z-debug.log
rudrakshi@rudrakshi-pc:~$ netlify
netlify: command not found
rudrakshi@rudrakshi-pc:~$ npm install http-server -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rudrakshi/.npm/_logs/2021-01-22T05_34_54_847Z-debug.log
我在 Ubuntu 20.10 上安装了 Graal JVM。
我尝试安装 express-generator,但收到以下错误消息:
$ npm install -g express-generator
bash: /usr/lib/jvm/graalvm/bin/npm: No such file or directory
确实,没有npm
目录。
我想删除 graal 并尝试重新安装或使用另一个 JVM。
如果我使用dpkg --list
.
这是否意味着我可以简单地删除/graal
文件夹而不会造成伤害?
更新:
看到接受的答案后,我从 PATH 中删除了 Graal,从 中删除了 Graal 文件夹/usr/lib/jvm
,并将我的默认设置更改为 OpenJDK 13。
一旦我这样做了,express-generator 安装就可以完美运行。
我正在尝试安装 npm 并找到了这个解决方案。我跑aptitude install npm
了,建议的解决方案是
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2)
but 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 is installed
Keep the following packages at their current version:
1) libnode-dev [Not Installed]
2) libssl-dev [Not Installed]
3) node-gyp [Not Installed]
4) npm [Not Installed]
Accept this solution? [Y/n/q/?]
它基本上是在建议降级,但是如果我将 libssl1.1 降级到 libssl1.0 会对我的系统产生什么影响?
编辑:将 Ubuntu 18.04 升级到 20.04 后出现此问题。Dan Scally的解决方案有效,我还在启动板的评论中提供了另一个选项,其中针对我的特定情况提供了更详细的信息。
Err:37 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64 Icons
Hash Sum mismatch
Hashes of expected file:
- Filesize:162899 [weak]
- SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
- SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
- MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
Hashes of received file:
- SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
- SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
- MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
- Filesize:162899 [weak]
Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
.
.
.
.
.
.
.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/main/dep11/by-hash/SHA256/9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b Hash Sum mismatch
Hashes of expected file:
- Filesize:162899 [weak]
- SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
- SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
- MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
Hashes of received file:
- SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
- SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
- MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
- Filesize:162899 [weak]
Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.
我已经尝试了其他答案中提供的所有可能的解决方案,但问题仍然存在。我正在使用 ubuntu 20.04。我是 Linux 环境的新手,所以我对 Linux 系统和术语了解不多。
我试图安装节点 js 和 npm。我在使用 apt-get 时遇到了很多问题。
问题:
使用 apt-get 安装后找不到 npm 命令
Command 'npm' not found, did you mean: command 'apm' from snap atom (1.48.0) command 'nsm' from snap nift (2.3.10) See 'snap info <snapname>' for additional versions.
当我尝试安装
sudo apt-get install python-software-properties
我有,
Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: python-software-properties : Depends: python (>= 2.7) but it is not going to be installed Depends: python (< 2.8) but it is not going to be installed Depends: python-apt (>= 0.6.20ubuntu16) but it is not going to be installed Depends: python-pycurl but it is not going to be installed E: Unable to correct problems, you have held broken packages.
当我尝试使用单独安装 npm 时
apt-get npm
The following packages have unmet dependencies: npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
当我使用npm install electron -g
时,我得到这个错误:
npm ERR! code EEXIST
npm ERR! path /usr/local/bin/electron
npm ERR! Refusing to delete /usr/local/bin/electron: ../lib/node_modules/electron-prebuilt/cli.js symlink target is not controlled by npm /usr/local/bin
npm ERR! File exists: /usr/local/bin/electron
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-03T23_17_02_469Z-debug.log
今天,突然间,Atom 根本无法安装任何软件包。它以前可以正常工作,我已经安装了一些软件包。但现在它失败了Exit status 134
。无论我尝试安装什么软件包,都会发生这种情况。我试过 Hydrogen 和 Atom Beautify,
我尝试了 Atom 设置中的 GUI 以及apm install ...
(使用和不使用 sudo)。
这是堆栈跟踪:
> [email protected] postinstall /tmp/apm-install-dir-120129-5590-622axg.s39i7/node_modules/atom-beautify/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated [email protected]: No longer maintained. We recomment migrating to ESLint with eslint-config-wikimedia.
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
Aborted (core dumped)
npm WARN enoent ENOENT: no such file or directory, open '/tmp/apm-install-dir-120129-5590-622axg.s39i7/package.json'
npm WARN apm-install-dir-120129-5590-622axg.s39i7 No description
npm WARN apm-install-dir-120129-5590-622axg.s39i7 No repository field.
npm WARN apm-install-dir-120129-5590-622axg.s39i7 No README data
npm WARN apm-install-dir-120129-5590-622axg.s39i7 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] 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! /root/.atom/.apm/_logs/2020-02-29T09_58_40_245Z-debug.log
日志文件的最后几行具有完全相同的堆栈。
我怀疑的一件事是我最近安装NodeJS
了npm
一个 Angular 项目。这会导致问题吗?
我在 Pop!_OS ( Ubuntu
)上19.10
,使用npm
6.13.6
, 和Node
v10.15.2
.
Hittingatom -v
给了我这个(注意 Node 版本与上面版本之间的区别):
Atom : 1.43.0
Electron: 4.2.7
Chrome : 69.0.3497.128
Node : 10.11.0
更新:
apm install language-vue
工作但apm install atom-beautify
仍然apm install hydrogen
失败。不知道这里有什么问题。
任何建议都会很可爱。提前致谢。:)