我有一个使用 create-react-app 创建的 React 应用程序。
为了编译 sass 文件,我正在使用 docs 中推荐的 node-sass-chokidar。
它在我的本地计算机(os x)上安装并运行良好。但是当我将它添加到我的生产服务器(运行 nginx 的 Ubuntu 14.04.5 x32)并运行
npm install
未安装。我可以通过检查 /node_modules 文件夹来看到它没有显示(就像在我的本地计算机上一样)。
Sass 已安装在服务器上。
当我运行 npm install 时,第一次运行时出现此错误
> [email protected] install
/var/www/bertgenerator.com/html/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/bin/nodejs',
node-pre-gyp verb cli '/var/www/bertgenerator.com/html/node_modules/fsevents/node_modules/.bin
node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | ia32
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/var/www/bertgenerator.com/html/node_modules/fsevents/lib/binding/Release/node-v48-linux-ia32/fse.node" (not found)
node-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v48-linux-ia32.tar.gz
node-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v48-linux-ia32.tar.gz
node-pre-gyp ERR! Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v48-linux-ia32.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v48-linux-ia32.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
make: Entering directory `/var/www/bertgenerator.com/html/node_modules/fsevents/build'
SOLINK_MODULE(target) Release/obj.target/.node
COPY Release/.node
make: Leaving directory `/var/www/bertgenerator.com/html/node_modules/fsevents/build'
node-pre-gyp info ok
不知道有没有关系。如果我再次运行 npm install 我不会收到错误。
我尝试删除 /node_modules 文件夹并运行
npm cache clean
以及
sudo npm install
你尝试过吗
sudo npm i
?
当其他方法都不起作用时,这对我有用。
npm i
在某些情况下,某些需要管理权限的软件包会默默失败,而 sudo 可确保这一点。