npm install error ENOTDIR

前端 未结 4 2130
误落风尘
误落风尘 2020-12-15 21:55

I am very new to Node.js and trying to install Flatiron using npm but it gives me an error.

sudo npm install flatiron -g

And I get -

相关标签:
4条回答
  • 2020-12-15 22:40

    Just solved the issue. Its because there's a file called tmp in the home directory.

    rm -rf ~/tmp
    sudo npm cache clear
    sudo npm install -g node
    

    Also... if you are trying to install npm then the same error and solution applies - delete ~/tmp

    0 讨论(0)
  • 2020-12-15 22:41

    Below are the steps to install a given release from source without root NOTE - this installs nodejs which gives you both node as well as npm, they come together per release.

    to start fresh remove prior node.js and npm installs as well as these :

    sudo mv ~/.npmrc ~/.npmrc_ignore
    sudo mv ~/.npm   ~/.npm_ignore
    sudo mv ~/tmp    ~/tmp_ignore
    sudo mv ~/.npm-init.js ~/.npm-init.js_ignore
    

    to install nodejs and npm as yourself NOT root do these commands (OSX/linux) :

    export NODE_PARENT=${HOME}/bin_0_10_32
    
    mkdir ${NODE_PARENT}
    

    download source from : http://nodejs.org/download/

    cd node-v0.xxxx
    
    ./configure   --prefix=${NODE_PARENT}/nodejs
    
    make -j8
    make install   #  IMPORTANT this is NOT using sudo
                   # not wanted since installing into $USER owned $NODE_PARENT
    

    which puts it into dir defined by above --prefix

    export PATH=${NODE_PARENT}/nodejs/bin:$PATH
    

    define environment variable NODE_PATH so node can find dir for modules otherwise npm install xxx will put newly installed module into current dir :

    export NODE_PATH=${NODE_PARENT}/nodejs/lib/node_modules
    

    when you use syntax : npm install -g some_cool_module the -g for global installs it into dir $NODE_PATH and not your $PWD

    nodejs install gives you npm as well :

    ls -la ${NODE_PARENT}/nodejs/bin
    

    Subsequent modules you install using global flag -g will automagically put their ~binaries~ into above bin dir ... like browserify

    Now put above three export xxx=yyy commands into your ~/.bashrc or some such so your environment is setup

    0 讨论(0)
  • 2020-12-15 22:49

    I direct delete the file of npm-debug.log. then it's ok for me.

    0 讨论(0)
  • 2020-12-15 22:50

    Try

    sudo mkdir -p /home/siddharthsaha/tmp
    sudo npm cache clear
    

    before starting the install script, since npm http 304 https://registry.npmjs.org/flatiron line states that this module is coming from cache. And also ENOTDIR states that there is no directory. Therefore, emptying the cache would solve your problem.

    0 讨论(0)
提交回复
热议问题