$ NODE_PATH for NVM版本的NODE无法正常工作

时间:2016-08-07 18:22:20

标签: node.js nvm

CLI上的

which node /me/.nvm/versions/node/v6.3.1/bin/node 正确指向NVM版本。

.zshrc

which node中,我尝试使用which node指向节点的NVM版本。     export NODE_PATH = source ~/.zshrc

来源吧.. which node me/.nvm/versions/node/v6.3.1/bin/node

我正在使用哪个节点?

echo $NODE_PATH
/usr/local/bin/node

正确的..

现在,回显$ NODE_PATH ..

import javax.sound.sampled.*;

public class SampleAudio {

    private static long extendSign(long temp, int bitsPerSample) {
        int extensionBits = 64 - bitsPerSample;
        return (temp << extensionBits) >> extensionBits;
    }

    public static void main(String[] args) throws LineUnavailableException {
        float sampleRate = 8000;
        int sampleSizeBits = 16;
        int numChannels = 1; // Mono
        AudioFormat format = new AudioFormat(sampleRate, sampleSizeBits, numChannels, true, true);
        TargetDataLine tdl = AudioSystem.getTargetDataLine(format);
        tdl.open(format);
        tdl.start();
        if (!tdl.isOpen()) {
            System.exit(1);         
        } 
        byte[] data = new byte[(int)sampleRate*10];
        int read = tdl.read(data, 0, (int)sampleRate*10);
        if (read > 0) {
            for (int i = 0; i < read-1; i = i + 2) {
                long val = ((data[i] & 0xffL) << 8L) | (data[i + 1] & 0xffL);
                long valf = extendSign(val, 16);
                System.out.println(i + "\t" + valf);
            }
        }
        tdl.close();
    }
}

错了..

1 个答案:

答案 0 :(得分:0)

NODE_PATH是一个环境变量,允许您从非标准位置require模块;它不应该是指向node二进制文件的指针。

换句话说,您应始终unset NODE_PATH