angular-cli: Cannot find module './models/config'
Running off the latest master I am getting the below error. @filipesilva @hansl
f9df8bb1730a5fe28e825db591a036157af34496
is the last commit that works for me.
Cannot find module './models/config'
Error: Cannot find module './models/config'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/zchapple/code/wfa_ng2/node_modules/angular-cli/addon/ng2/index.js:4:16)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
Here is my current angular-cli config. From what I can tell matches the current one on master.
{
"project": {
"version": "1.0.0-beta.11-webpack.2",
"name": "wfa-ng2"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": "assets",
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "wfa",
"mobile": false,
"styles":[
"styles.css"
],
"scripts": [
"../public/d3/d3.min.js",
"../public/lodash/lodash.min.js"
],
"environments": {
"source": "environments/environment.ts",
"prod": "environments/environment.prod.ts",
"dev": "environments/environment.dev.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "config/protractor.conf.js"
}
},
"test": {
"karma": {
"config": "config/karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": true,
"lazyRoutePrefix": "+"
}
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 39 (8 by maintainers)
I fixed this error. Turns out that angular-cli was installed globally in two locations (still don’t know how I managed to do that). Once in the nodeJS directory and once in the users/AppData/Roaming/npm. What happened is that in the command-line, angular-cli was still pointing to the webpack.2 install instead of the webpack.8.
Once I figured this out and properly installed the webpack.8 and made sure my package.json included the webpack.8 version, the error was resolved.
So: npm uninstall -g angular-cli npm install -g angular-cli@1.0.0-beta.11-webpack.8
And put the angular-cli 1.0.0-beta.11-webpack.8 in your package.json
@cybey Yes! Uninstalling and reinstalling it again with precise version worked…
Used node 6.5.0.
I tried everything above and I’m still getting the same error
Bumping global CLI allowed me to get past this as well.
same lol
@kylecordes I am stuck still getting the same errors as posted above. I am using node 6.5.0 and have installed webpack version globally. I am running out of ideas…
In my case, I found a
node_modules/
directory living in my user folder. Not sure how it got there, but deleting it resolved my issue.