简体   繁体   中英

angular-cli: ng new my-dream-app error

I'm trying to create a new Angular 2 app using Angular CLI, but getting an error.

Here's the information I could think of collecting:

Version Information

When I run:

ng version

I get:

(node:3184) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
angular-cli: 0.1.0
node: 6.1.0
os: win32 x64

Error Information

When I run:

ng new my-dream-app

I get:

(node:176) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Cannot find module 'config-chain'
Error: Cannot find module 'config-chain'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\work\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\lib\config\core.js:2:10)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

Thanks in advance

Try this:

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest

I have seen that when I tried to install webdriver-manager as non-global NPm dependency into the project generated by Angular CLI.

So, here are a couple of things to try, based on the difference between my environment and tries, and your tries and the versions written in your question.

  • Ignore "node:88754", this is the one safe to bypass

  • Upgrade NPM to latest version, for me that was 3.9.0

     npm update -g npm 
  • Try to install "webdriver-manager" globally

     npm install -g webdriver-manager 

    There are issues with current NPM that might get you errors. The current workaround is to just retry for a couple of times :(

  • Update Angular CLI version (mine says "1.0.0 -beta.1 ")

     npm install -g angular-cli 

    Make sure ng --version returns something equal to or higher than mine.

Not sure if this will fix it for you 100%, but we can take it from there and see what you get then.

Uninstall angular-cli with cmd: npm uninstall angular-cli And reinstall with the cmd: npm install -g angular-cli

Hop that will help you.

great help!!! thanks. i had this message on Console when tried to create an angular project. ng new tour-of-heroes.... then and i get this error:

Error: Cannot Find module 'source-map-resolve' ......

i try this and it works.

npm uninstall -g angular-cli npm cache clean npm install -g angular-cli@latest

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM