永远安装npm和机械师

时间:2018-06-14 15:51:21

标签: npm centos apostrophe-cms

我的目标是在Windows 10计算机上为ApostropheCMS(https://apostrophecms.org/docs/)设置开发环境。为了实现这个目标,我在Docker容器中运行CentOS,并按照这些说明安装Apostrophe: https://apostrophecms.org/docs/tutorials/intermediate/deployment.html

我或多或少能够无错误地完成以下安装:

## My docker command, to get CentOS bash in a new container
docker run -it centos bash

## Apostrophe CMS install script, run inside CentOS Bash
# Grab some command line basics
yum install wget rsync perl git nano
# Allow the use of the EPEL ("Extra Packages for Enterprise Linux") repository
yum install epel-release
# Front end proxy webserver
yum install nginx
# Install node, imagemagick, npm, and compiler tools so an efficient
# mongo driver can be compiled by npm
yum install gcc automake autoconf libtool make nodejs ImageMagick npm
# Install mongodb
yum install mongodb-server mongodb
# Allow non-root users to run command line applications installed with
# "npm install -g", otherwise it is not very useful
chmod -R a+r /usr/lib/node_modules/

然而,我从npm安装永久和机制的两个命令得到错误或警告。错误在下面的附录中。

# Used to run things indefinitely restarting as needed
npm install -g forever
# Used to manage nginx
npm install -g mechanic

我的问题是:

  1. 我甚至需要永远和机械师的开发实例?即,我将要做的就是在本地开发并部署到服务器?
  2. 如果是,我怎样才能安装这些错误?
  3. 我意识到这些都是noob级别的问题。我是CentOS,Docker和Apostrophe的新手。感谢您的耐心,理解和建议。

    附录:错误

    倒数第二个命令:

    # Used to run things indefinitely restarting as needed
    npm install -g forever
    

    给我:

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/forever/node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    

    最后的命令:

    # Used to manage nginx
    npm install -g mechanic
    

    给我:

    gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/6.14.2"
    gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/mechanic/node_modules/fs-ext/.node-gyp"
    make: Entering directory `/usr/lib/node_modules/mechanic/node_modules/fs-ext/build'
      CXX(target) Release/obj.target/fs-ext/fs-ext.o
    make: g++: Command not found
    make: *** [Release/obj.target/fs-ext/fs-ext.o] Error 127
    make: Leaving directory `/usr/lib/node_modules/mechanic/node_modules/fs-ext/build'
    gyp ERR! build error
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:276:23)
    gyp ERR! stack     at emitTwo (events.js:106:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
    gyp ERR! System Linux 4.9.87-linuxkit-aufs
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
    gyp ERR! cwd /usr/lib/node_modules/mechanic/node_modules/fs-ext
    gyp ERR! node -v v6.14.2
    gyp ERR! node-gyp -v v3.4.0
    gyp ERR! not ok
    /usr/lib
    `-- (empty)
    
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/mechanic/node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    npm ERR! Linux 4.9.87-linuxkit-aufs
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "mechanic"
    npm ERR! node v6.14.2
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE
    
    npm ERR! fs-ext@0.5.0 install: `node-gyp configure build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the fs-ext@0.5.0 install script 'node-gyp configure build'.
    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 fs-ext package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-gyp configure build
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs fs-ext
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls fs-ext
    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
    npm ERR! code 1
    

1 个答案:

答案 0 :(得分:1)

确实,this recipe on our documentation site有一些疏忽。您遗失的重要yum包是gcc-c++

yum install gcc-c++

此外,我已经更新了整个配方,以便从更好的存储库中包含更好的节点版本和mongodb。 (EPEL存储库确实提供了MongoDB的一个版本,但它已经过时了。该存储库中的节点版本稍好一些,但为什么不具有8.x,因为它是当前的长期支持版本。)

感谢您引起我们的注意。