eem*_*ilk 7 node.js npm npm-install wsl-2
我有一个运行良好的反应项目。node(v14.17.0) 和npm(7.19.1) 随 一起安装nvm。
使用 npm 安装软件包很好,例如对于 ssh2,但安装它时,它不会安装可选软件包cpu-features https://github.com/mscdex/cpu-features
运行时npm install cpu-features出现错误npm ERR! /bin/sh: 1: cmake: Permission denied
整个错误消息:
npm ERR! code 1
npm ERR! path /mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features/build'
npm ERR! ACTION Configuring dependencies /mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features/deps/cpu_features/build/Makefile
npm ERR! make: Leaving directory '/mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/ilkkae/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/ilkkae/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/ilkkae/.cache/node-gyp/14.17.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/ilkkae/.cache/node-gyp/14.17.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/ilkkae/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/ilkkae/.cache/node-gyp/14.17.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: Warning: File 'cpufeatures.target.mk' has modification time 0.11 s in the future
npm ERR! /bin/sh: 1: cmake: Permission denied
npm ERR! make: *** [config_deps.target.mk:13: /mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features/deps/cpu_features/build/Makefile] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/home/ilkkae/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:376:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
npm ERR! gyp ERR! System Linux 5.4.72-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/home/ilkkae/.nvm/versions/node/v14.17.0/bin/node" "/home/ilkkae/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /mnt/c/Users/ilkka/Projects/draganddrop/node_modules/cpu-features
npm ERR! gyp ERR! node -v v14.17.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
Run Code Online (Sandbox Code Playgroud)
我尝试将所有文件传输到 wsl 端,而不是 mnt 文件夹,运行时sudo会导致 npm 安装挂起,无论如何都不建议这样做。
我还尝试以 root 用户身份运行。
我想知道为什么会收到拒绝授权错误消息。文件和文件夹不是 root 用户/组。
Art*_*iss 12
确保您已经cmake在 Linux 中安装了模块。它不会与构建必需品一起安装。这就是我摆脱同样错误的方法。
sudo apt-get install cmake
Run Code Online (Sandbox Code Playgroud)
小智 9
除了@Artoiss的回答之外,如果你是像我一样遇到这个问题的Mac用户,你可以使用Brew轻松安装它;
brew install cmake
Run Code Online (Sandbox Code Playgroud)
如果您的 Mac 上尚未安装 Brew,请查看此处Home Brew - 安装
| 归档时间: |
|
| 查看次数: |
8584 次 |
| 最近记录: |