AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[npm](server)

Martin Hope
Aero Windwalker
Asked: 2020-06-05 20:40:09 +0800 CST

使用 sudo 时,npm 的神奇之路是什么?

  • -2

sudo ${which npm} run xxx我记得当我需要 root 权限来运行 npm 时,我能够使用类似的东西。它是什么?

sudo npm
  • 1 个回答
  • 68 Views
Martin Hope
Aaron
Asked: 2020-05-01 01:11:24 +0800 CST

NPM 问题,从哪里开始

  • 1

希望这是发布的正确论坛。即将到来的堆栈溢出,但我认为这更多的是你们的专业知识。

我有一个 centos 6.10 盒子。它的 Node.js 和 npm 运行正常。我不知道他们是哪个版本的。我试图通过运行将它们更新到 LTS

sudo npm install n -g

现在,每当我运行时,npm我都会收到此错误:

node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by node)

我试图完全卸载 node 和 npm 并重新安装它们,也没有运气。现在我没有技巧了。有人可以帮我解决我现在应该做什么吗?

node.js npm
  • 1 个回答
  • 2467 Views
Martin Hope
Nissy A.W.
Asked: 2020-04-09 01:59:02 +0800 CST

NodeJS反应系统服务不工作

  • 5

我正在尝试为一个简单的反应应用程序设置一个 systemd 服务。此应用程序托管在 /home/myuser/test 中。npm 和 node 都在 PATH 中并且硬链接到 /usr/bin。所有文件都具有 myuser:myuser 用户和组的权限。如果我手动启动npm start它,它会正确启动并从http://localhost:3000

    Compiled successfully!

You can now view test in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://myipaddress:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

如果我尝试通过 systemd 启动应用程序,它会失败但没有说明原因。我使用相同的用户从相同的路径启动它,并尝试了 ExecStart 可以想象的所有组合:

ExecStart=npm start
ExecStart=/usr/bin/npm start
ExecStart=/usr/bin/node /home/myuser/test/node_modules/react-scripts/scripts/start.js

它们都产生相同的结果,即它“开始”正常,并且在它失败后不久,在 journalctl 中显然没有理由:

 $sudo systemctl status node-client   
 ● node-client.service - Node-React Frontend Server
   Loaded: loaded (/etc/systemd/system/node-client.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-04-08 09:46:10 UTC; 679ms ago
 Main PID: 18165 (node)
   CGroup: /system.slice/node-client.service
           └─18165 /usr/bin/node /home/myuser/test/node_modules/react-scripts/scripts/start.js

Apr 08 09:46:10 hostname systemd[1]: Started Node-React Frontend Server.
Apr 08 09:46:10 hostname systemd[1]: Starting Node-React Frontend Server...

几秒钟后……

$sudo systemctl status node-client
● node-client.service - Node-React Frontend Server
   Loaded: loaded (/etc/systemd/system/node-client.service; disabled; vendor preset: disabled)
   Active: activating (auto-restart) since Wed 2020-04-08 09:46:00 UTC; 3s ago
  Process: 18142 ExecStart=/usr/bin/node /home/ec2-user/test/node_modules/react-scripts/scripts/start.js (code=exited, status=0/SUCCESS)
 Main PID: 18142 (code=exited, status=0/SUCCESS)

我在 journalctl 上不断收到以下信息

    -- Logs begin at Tue 2020-03-17 15:04:59 UTC, end at Wed 2020-04-08 09:48:23 UTC. --
Apr 08 09:48:22 hostname systemd[1]: Starting Node-React Frontend Server...
Apr 08 09:48:22 hostname systemd[1]: Started Node-React Frontend Server.
Apr 08 09:48:22 hostname systemd[1]: node-client.service holdoff time over, scheduling restart.
Apr 08 09:48:12 hostname nodeclient[18390]: Starting the development server...
Apr 08 09:48:12 hostname nodeclient[18390]: ℹ 「wds」: 404s will fallback to /
Apr 08 09:48:12 hostname nodeclient[18390]: ℹ 「wds」: Content not from webpack is served from /home/myuser/test/public
Apr 08 09:48:12 hostname nodeclient[18390]: ℹ 「wds」: webpack output is served from
Apr 08 09:48:12 hostname nodeclient[18390]: ℹ 「wds」: Project is running at http://myipaddress/
Apr 08 09:48:10 hostname systemd[1]: Starting Node-React Frontend Server...
Apr 08 09:48:10 hostname systemd[1]: Started Node-React Frontend Server.
Apr 08 09:48:10 hostname systemd[1]: node-client.service holdoff time over, scheduling restart.
Apr 08 09:48:00 hostname nodeclient[18368]: Starting the development server...
Apr 08 09:48:00 hostname nodeclient[18368]: ℹ 「wds」: 404s will fallback to /
Apr 08 09:48:00 hostname nodeclient[18368]: ℹ 「wds」: Content not from webpack is served from /home/myuser/test/public
Apr 08 09:48:00 hostname nodeclient[18368]: ℹ 「wds」: webpack output is served from
Apr 08 09:48:00 hosntame nodeclient[18368]: ℹ 「wds」: Project is running at http://myipaddress/

systemd 服务文件随着时间的推移发生了变化,但无论 ExecStart 和其他更改如何,错误都是相同的,这是目前的内容:

[Unit]
Description=Node-React Frontend Server
After=syslog.target network.target

[Service]
ExecStart=/usr/bin/node node_modules/react-scripts/scripts/start.js
Restart=always
RestartSec=10s
TimeoutSec=900
User=myuser
Group=myuser
Environment=PATH=/usr/bin:/usr/local/bin
WorkingDirectory=/home/myuser/test/
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodeclient

[Install]
WantedBy=multi-user.target

操作系统是Centos7。所有测试都是使用相同的用户完成的,没有 sudo,手动和通过 systemd 使用相同的命令。手动启动有效,systemd 无效。

最后,提一下,我通过 systemd 拥有 Express-NodeJS 应用程序,并且它使用相同的 systemd 配置正确启动。它只对 React 失败。

任何帮助将不胜感激!

谢谢

尼西

systemd node.js npm
  • 3 个回答
  • 3195 Views
Martin Hope
Ashish Karpe
Asked: 2017-01-10 02:59:07 +0800 CST

码头工人 npm 错误!安装无法读取依赖项

  • 0

尝试 Docker 教程https://prakhar.me/docker-curriculum/#dockerrun 在运行 root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web 时出错。

root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web .
Sending build context to Docker daemon 5.32 MB
Step 1 : FROM ubuntu:14.04
---> 3f755ca42730
Step 2 : MAINTAINER Prakhar Srivastav [email protected]
---> Using cache
---> ca0cf0254114
Step 3 : RUN apt-get -yqq update
---> Using cache
---> 4952fb95a34d
Step 4 : RUN apt-get -yqq install python-pip python-dev
---> Using cache
---> 73bd849c6164
Step 5 : RUN apt-get -yqq install nodejs npm
---> Using cache
---> c48d602eccda
Step 6 : RUN ln -s /usr/bin/nodejs /usr/bin/node
---> Using cache
---> 221206c99a7f
Step 7 : ADD flask-app /opt/flask-app
---> Using cache
---> 7ddfac0cdf0e
Step 8 : WORKDIR /opt/flask-app
---> Using cache
---> 451217e08677
Step 9 : RUN npm install
---> Running in 547c36e97297

npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open '/opt/flask-app/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-92-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /opt/flask-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /opt/flask-app/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/flask-app/npm-debug.log
npm ERR! not ok code 0

我的 Docker 文件:

# cat Dockerfile
# start from base
FROM ubuntu:14.04
MAINTAINER Prakhar Srivastav <[email protected]>

# install system-wide deps for python and node
RUN apt-get -yqq update
RUN apt-get -yqq install python-pip python-dev
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node

# copy our application code
ADD flask-app /opt/flask-app
WORKDIR /opt/flask-app

# fetch app specific deps
RUN npm install
RUN npm run build
RUN pip install -r requirements.txt

# expose port
EXPOSE 5000
ubuntu dependencies docker npm
  • 1 个回答
  • 558 Views
Martin Hope
Antoine
Asked: 2016-10-26 07:30:03 +0800 CST

如何启动 let'schat (nodejs app) 作为守护进程?

  • 0

我已经在我的服务器上安装了“让我们聊天”。在文档中,他们说要启动应用程序

npm start

从安装应用程序的目录。

但我无法使用 systemd 启动它。我希望应用程序始终在线。所以如果我手动启动它就可以了

cd /MIDDLE/uow/lets-chat/ && /bin/npm start

但如果我从 systemd 配置 Execstart 中的行,则不会。我尝试使用同一行,我尝试使用 npm,我尝试使用 "node ./apps.js" :

ExecStart=/usr/bin/cd /MIDDLE/uow/lets-chat/ && /usr/local/bin/node /MIDDLE/uow/lets-chat/app.js 

(我尝试使用或不使用命令的绝对路径,但它没有任何改变)。

我不知道如何在我的 centos 中将这个应用程序作为守护进程启动。请问我该怎么办?

谢谢,

一个。

daemon systemd node.js npm
  • 1 个回答
  • 107 Views
Martin Hope
Emil Moe
Asked: 2016-07-21 04:15:35 +0800 CST

安装节点模块时出现 Node-sass 错误

  • 3

我正在尝试在我的 Debian 服务器上安装 Laravel,但在安装node-sass. 我有这个设置很长时间了,以前从未遇到过问题。也许node-sass或npm最近改变了什么?

希望你能帮助我,我已经卡了2天了。

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     npm-debug.log
linux debian node.js npm
  • 1 个回答
  • 5240 Views
Martin Hope
David S.
Asked: 2014-10-23 15:27:56 +0800 CST

npm install generator-webapp 失败

  • 3

我已经清理了我的运行npm remove ...并npm -g remove ...删除了与npm. 但是当我尝试时我仍然遇到错误npm install generator-webapp

npm ERR! peerinvalid The package yo does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants yo@>=1.0.0
npm ERR! peerinvalid Peer [email protected] wants yo@>=1.2.0

知道如何解决吗?我搜索了一段时间,唯一的建议是清理我的npm包裹。

npm
  • 2 个回答
  • 1219 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve