【发布时间】:2018-11-28 20:46:48
【问题描述】:
我正在做一个使用 nvm 的项目。
不知何故,我在运行“npm start”时开始收到此错误:
npm start
> sh ./bin/start.sh
nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/Users/user/.nvm/versions/node/v8.9.4"
Run `unset npm_config_prefix` to unset it.
Found '/Users/user/project/project/.nvmrc' with version <8.9.0>
nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/Users/user/.nvm/versions/node/v8.9.4"
Run `unset npm_config_prefix` to unset it.
/Users/user/project/project/node_modules/node-sass/lib/binding.js:15
throw new Error(errors.missingBinary());
^
Error: Missing binding /Users/user/project/project/node_modules/node-sass/vendor/darwin-x64-59/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 9.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 8.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
at module.exports (/Users/user/project/project/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/Users/user/project/project/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/user/project/project/node_modules/node-sass/bin/node-sass:10:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @namespace/project@5.14.1 start: `sh ./bin/start.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @namespace/project@5.14.1 start 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! /Users/user/.npm/_logs/2018-06-19T19_30_15_079Z-debug.log
我已经尝试了以下操作,但没有成功:
1) 删除repo,再次克隆并运行npm install
2) 更新 npm
3) 删除nvm文件夹并重新下载
4) 运行unset npm_config_prefix
5) 运行npm rebuild node-sass --force
Obs.:我在 Mac OS 10.13.4 上使用 zsh 终端
【问题讨论】:
-
你试过运行:unset npm_config_prefix 吗?
-
@MiguelOrtiz 是的,我做到了
-
尝试完全卸载节点,不要忘记检查每个文件,这是一个很好的清单:gist.github.com/TonyMtz/d75101d9bdf764c890ef
-
您好,我遇到了和您一样的问题,您解决了吗?