0

when I try to install nodebb and init it with command "nodebb setup", and then install third-part pack automatically, it always runs into an error, the error msg as below。

yes it alway sharp, I hate that.

I don't know why not permission, I'am root role. I tried to mkdir by myself but the npm remove it and then told me, "permission denied", excuse me?????

I try to install sharp with npm install sharp --ignore-scripts and install the dependence by myself. by this way can I run the nodebb server, but when I try to upload an image from the browser, and sharp it, the nodebb got an error as below the last

this is some erro msg with install:

[root@bbs NodeBB]# npm install sharp
> sharp@0.23.0 install /home/bbs/NodeBB/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /root/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/home/bbs/NodeBB/node_modules/sharp/vendor'
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/bbs/NodeBB/node_modules/sharp/build'
gyp ERR! System Linux 3.10.0-957.el7.x86_64
gyp ERR! command "/usr/share/node-v12.9.1-linux-x64/bin/node" "/usr/share/node-v12.9.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bbs/NodeBB/node_modules/sharp
gyp ERR! node -v v12.9.1
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.23.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.23.0 install 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/.npm/_logs/2019-09-11T06_23_30_748Z-debug.log

this is some error msg when upload image:

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'
Require stack:
- /home/bbs/NodeBB/node_modules/sharp/lib/constructor.js
- /home/bbs/NodeBB/node_modules/sharp/lib/index.js
- /home/bbs/NodeBB/src/file.js
- /home/bbs/NodeBB/require-main.js
- /home/bbs/NodeBB/app.js

- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues
Mehul Kabaria
  • 6,404
  • 4
  • 25
  • 50
hec9527
  • 61
  • 1
  • 7

4 Answers4

4

i resolved it,but i don't know why

by this command:sudo chown -R $(whoami) node_modules/

I always use root, nice power

hec9527
  • 61
  • 1
  • 7
1

I came across this error after upgrading Node from v10 to v12. My projects still used the node_modules that have been installed when I had v10. So I guess they get installed differently with another Node version. The following helped me:

rm -rf node_modules
rm package-lock.json
npm install

Now every installed node module used the latest latest Node version during the installation.

Robin Wieruch
  • 14,900
  • 10
  • 82
  • 107
0

If you live in the same country as me, so the biggest reason is the GFW. I once encountered the same problem as you. You can try to modify the npm mirror source for this.

AllinProgram
  • 188
  • 4
0

I got the same error with sharp install, trying to install NodeBB 1.12.1. The problem seems to be with an outdated sharp version. I resolved it correcting the required sharp version in package.json. Here is the solution:

  • clone the repository
    git clone https://github.com/NodeBB/NodeBB.git nodebb
  • checkout to the required branch
    git checkout v1.12.1
  • go to ~/nodebb/install and in package.json change required sharp version to 0.22.1
    {"dependencies: {
    ...
           "sharp": "0.24.0",
    ...
    }
  • now, start the setup process
    ./nodebb setup

Everything should work fine now.