更新brew并重新安装node后,设置依赖项时出现错误。 告诉我如何解决这个问题?
下面的代码不是全部错误,因为字符数有限制,所以只有一部分。
节点v10.2.1
PHP 7.2.6 (cli)(构建时间:2018 年 5 月 25 日 06:18:43)(NTS)
Python 2.7.10(默认,2017 年 10 月 6 日,22:29:07)
⟩ yarn install --save-dev
yarn install v0.15.1
warning [email protected]: No license field
warning [email protected]: Dependency "path" listed in "devDependencies" is the name of a built-in module
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] 🔗 Linking dependencies...
warning Unmet peer dependency "jquery@>=1.9.0".
[4/4] 📃 Building fresh packages...
[1/1] ⠐ node-sass: not ok
[-/1] ⠐ waiting...
[-/1] ⠐ waiting...
[-/1] ⠐ waiting...
error /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/build.js
Directory: /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/node-sass
Output:
Building: /usr/local/Cellar/node/10.2.1/bin/node /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/Cellar/node/10.2.1/bin/node',
gyp verb cli '/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:80:29)
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:89:16
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:182:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:80:29)
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:89:16
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:182:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python2\n at getNotFoundError (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:13:12)\n at F (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:68:19)\n at E (/Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:80:29)\n at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/which/which.js:89:16\n at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/index.js:42:5\n at /Users/Maxim/Projects/diod-market/Company/Bundle/CompanyBundle/Resources/static/node_modules/isexe/mode.js:8:5\n at FSReqWrap.oncomplete (fs.js:182:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: 10.2.1
gyp verb command install [ '10.2.1' ]
gyp verb install input version string "10.2.1"
gyp verb install installing version: 10.2.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 10.2.1
gyp verb ensuring nodedir is created /Users/Maxim/.node-gyp/10.2.1
gyp verb created nodedir /Users/Maxim/.node-gyp/10.2.1
gyp http GET https://nodejs.org/download/release/v10.2.1/node-v10.2.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.2.1/node-v10.2.1-headers.tar.gz
gyp verb extracted file from tarball include/node/android-ifaddrs.h
gyp verb extracted file from tarball include/node/common.gypi
gyp verb extracted file from tarball include/node/config.gypi
gyp verb extracted file from tarball include/node/node.h
gyp verb extracted file from tarball include/node/node_api.h
gyp verb extracted file from tarball include/node/node_api_types.h
gyp verb extracted file from tarball include/node/node_buffer.h
gyp verb extracted file from tarball include/node/node_object_wrap.h
gyp verb extracted file from tarball include/node/node_version.h
gyp verb extracted file from tarball include/node/pthread-barrier.h
gyp verb extracted file from tarball include/node/stdint-msvc2008.h
gyp verb extracted file from tarball include/node/tree.h
gyp verb extracted file from tarball include/node/uv-aix.h
gyp verb extracted file from tarball include/node/uv-bsd.h
gyp verb extracted file from tarball include/node/uv-darwin.h
gyp verb extracted file from tarball include/node/uv-errno.h
gyp verb extracted file from tarball include/node/uv-linux.h
gyp verb extracted file from tarball include/node/uv-os390.h
gyp verb extracted file from tarball include/node/uv-posix.h
gyp verb extracted file from tarball include/node/uv-sunos.h
gyp verb extracted file from tarball include/node/uv-threadpool.h
gyp verb extracted file from tarball include/node/uv-unix.h
gyp verb extracted file from tarball include/node/uv-version.h
gyp verb extracted file from tarball include/node/uv-win.h
gyp verb extracted file from tarball include/node/uv.h
gyp verb extracted file from tarball include/node/v8-inspector-protocol.h
gyp verb extracted file from tarball include/node/v8-inspector.h
gyp verb extracted file from tarball include/node/v8-platform.h
gyp verb extracted file from tarball include/node/v8-profiler.h
gyp verb extracted file from tarball include/node/v8-testing.h
gyp verb extracted file from tarball include/node/v8-util.h
gyp verb extracted file from tarball include/node/v8-value-serializer-version.h
gyp verb extracted file from tarball include/node/v8-version-string.h
gyp verb extracted file from tarball include/node/v8-version.h
gyp verb extracted file from tarball include/node/v8.h
gyp verb extracted file from tarball include/node/v8config.h
gyp verb extracted file from tarball include/node/zconf.h
gyp verb extracted file from tarball include/node/zlib.h
gyp verb extracted file from tarball include/node/openssl/aes.h
gyp verb extracted file from tarball include/node/openssl/asn1.h
gyp verb extracted file from tarball include/node/openssl/asn1_mac.h
gyp verb extracted file from tarball include/node/openssl/asn1t.h
gyp verb extracted file from tarball include/node/openssl/async.h
gyp verb extracted file from tarball include/node/openssl/bio.h
gyp verb extracted file from tarball include/node/openssl/blowfish.h
gyp verb extracted file from tarball include/node/openssl/bn.h
gyp verb extracted file from tarball include/node/openssl/bn_conf.h
gyp verb extracted file from tarball include/node/openssl/bn_conf_asm.h
gyp verb extracted file from tarball include/node/openssl/bn_conf_no-asm.h
gyp verb extracted file from tarball include/node/openssl/buffer.h
gyp verb extracted file from tarball include/node/openssl/camellia.h
gyp verb extracted file from tarball include/node/openssl/cast.h
gyp verb extracted file from tarball include/node/openssl/cmac.h
gyp verb extracted file from tarball include/node/openssl/cms.h
gyp verb extracted file from tarball include/node/openssl/comp.h
gyp verb extracted file from tarball include/node/openssl/conf.h
gyp verb extracted file from tarball include/node/openssl/conf_api.h
gyp verb extracted file from tarball include/node/openssl/crypto.h
gyp verb extracted file from tarball include/node/openssl/ct.h
gyp verb extracted file from tarball include/node/openssl/des.h
gyp verb extracted file from tarball include/node/openssl/dh.h
gyp verb extracted file from tarball include/node/openssl/dsa.h
gyp verb extracted file from tarball include/node/openssl/dso_conf.h
gyp verb extracted file from tarball include/node/openssl/dso_conf_asm.h
gyp verb extracted file from tarball include/node/openssl/dso_conf_no-asm.h
gyp verb extracted file from tarball include/node/openssl/dtls1.h
gyp verb extracted file from tarball include/node/openssl/e_os2.h
gyp verb extracted file from tarball include/node/openssl/ebcdic.h
确保您的
node
版本支持您的 node-sass
版本。
看看你的
package.json
,看看是否
"node-sass": "^X.X.X",
根据链接表匹配您的节点版本。
此外,请确保您正在运行您想要运行的节点版本。检查
which node
,如果您使用 nvm
或 n
,请不要忘记
nvm use X
或
n X
其中 X 是所需的节点版本。
支持的 Node.js 版本因版本而异,请查看 Node 版本支持政策
NodeJS | 支持的node-sass版本 | 节点模块 |
---|---|---|
节点 19 | 8.0+ | 111 |
节点 18 | 8.0+ | 108 |
节点17 | 7.0+,<8.0 | 102 |
节点16 | 6.0+ | 93 |
节点15 | 5.0+,<7.0 | 88 |
节点14 | 4.14+ | 83 |
节点13 | 4.13+,<5.0 | 79 |
节点12 | 4.12+,<8.0 | 72 |
节点11 | 4.10+,<5.0 | 67 |
节点10 | 4.9+,<6.0 | 64 |
节点8 | 4.5.3+,<5.0 | 57 |
节点<8 | <5.0 | <57 |
如果升级node-sass包不可行,最好使用node版本管理器切换到Nodejs的兼容版本。
日志流中的关键行可能是:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
我建议安装 python2 (或设置一个环境变量指向它)。
注意: node-sass 已贬值