`yo angular` gives error: npm ERR! code ENOENT npm ERR! errno 34 (yes I have cleaned the cache and set .npmignore)

后端 未结 5 1130
名媛妹妹
名媛妹妹 2020-12-08 10:50

I tried to run yo angular in a new project directory, but it gave me the ENOENT error somewhere along the way. Yes I have looked at this similar question, but i

5条回答
  •  Happy的楠姐
    2020-12-08 11:22

    EDIT: npm update -g followed by npm cache clear should work for most. However, when first installing on Mac OS you may need to navigate to your usr/local/lib/node_modules folder once nodeJS is first installed and grant read/write permission to "Everyone". Node won't be able to installed additional workflow components globally until those permissions are released. You don't want to sudo the npm install commands, because then those tools won't have sudo access to run after the fact. Read/write permissions are changed by right-clicking the folder and going to "Get info" then changing permissions at bottom of popup.

    I had this same issue on Windows 7 machine. Here are the steps I took to resolve:

    • repair Node installation
    • open elevated cli
    • run npm update -g
    • run npm cache clear
    • run npm install -g yo
    • run npm cache clear
    • run npm install -g generator-angular
    • run npm cache clear
    • created new directory
    • run yo angular test
    • run npm cache clear
    • run grunt serve

    I did run into some other issues with karma.conf.js where the paths had a \ instead of / for bower_components. Also, I noticed the optional angular modules were injected in my app.js despite not including them all in my yo build from the cli. I have reported these issues on github.

提交回复
热议问题