angular / angular2-seed

MIT License
1.01k stars 640 forks source link

Can't resolve 'strip-ansi' and Can't resolve 'sockjs-client' #150

Closed blackcatIan closed 7 years ago

blackcatIan commented 7 years ago

Env: windows 7 nodejs version v6.9.2 nmp version 3.10.9

I download the zip of angular2-seed and then open it with webstorm

I change the package.json script: add "prestart":"cnpm install" in order to use nodejs mirror

I run script [prestart] and then run [start]

{ "name": "angular2-seed", "version": "1.0.0", "description": "A simple starter Angular2 project", "scripts": { "prestart": "cnpm install", "build": "webpack --progress", "watch": "npm run build -- --watch", "server": "webpack-dev-server --inline --progress --port 3000 --content-base src", "start": "npm run server" }, "contributors": ["Rob Wormald robwormald@gmail.com", "PatrickJS github@gdi2290.com"], "license": "MIT", "dependencies": { "@angular/common": "~2.2.1", "@angular/compiler": "~2.2.1", "@angular/compiler-cli": "~2.2.1", "@angular/core": "~2.2.1", "@angular/forms": "~2.2.1", "@angular/http": "~2.2.1", "@angular/platform-browser": "~2.2.1", "@angular/platform-browser-dynamic": "~2.2.1", "@angular/platform-server": "~2.2.1", "@angular/router": "~3.2.1", "@angular/upgrade": "~2.2.1", "angular2-in-memory-web-api": "0.0.21", "bootstrap": "^3.3.7", "core-js": "^2.4.1", "ie-shim": "^0.1.0", "reflect-metadata": "^0.1.3", "rxjs": "5.0.0-beta.12", "zone.js": "~0.6.26" }, "devDependencies": { "@types/node": "^6.0.48", "angular2-router-loader": "^0.3.4", "angular2-template-loader": "^0.6.0", "awesome-typescript-loader": "^2.2.4", "css-loader": "^0.25.0", "raw-loader": "^0.5.1", "to-string-loader": "^1.1.4", "typescript": "~2.0.10", "webpack": "2.1.0-beta.27", "webpack-dev-server": "2.1.0-beta.11", "webpack-merge": "^0.15.0" }, "keywords": ["Angular2", "angular2-seed", "official angular 2 seed", "official angular2 seed"], "repository": { "type": "git", "url": "git+https://github.com/angular/angular2-seed.git" }, "bugs": { "url": "https://github.com/angular/angular2-seed/issues" }, "homepage": "https://github.com/angular/angular2-seed#readme" }

I got Error with

"D:\dev_tool\WebStorm 2016.1\bin\runnerw.exe" D:\dev_tool\nodejs\node.exe D:\dev_tool\nodejs\node_modules\npm\bin\npm-cli.js run-script start

angular2-seed@1.0.0 prestart E:\study_work\angular2-seed-master cnpm install

(node:14976) 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.

angular2-seed@1.0.0 start E:\study_work\angular2-seed-master npm run server

angular2-seed@1.0.0 server E:\study_work\angular2-seed-master webpack-dev-server --inline --progress --port 3000 --content-base src

0% compiling10% building modules 0/1 modules 1 active multi main ........... Project is running at http://localhost:3000/ webpack output is served from / Content not from webpack is served from E:\study_work\angular2-seed-master\src 404s will fallback to /index.html ........... ........... ........... ........... ........... ........... ........... ........... [704] (webpack)/~/node-libs-browser/~/url/util.js 314 bytes {0} [built] [705] ./~/zone.js/dist/long-stack-trace-zone.js 5.49 kB {0} [built] [706] ./~/zone.js/dist/zone.js 58.2 kB {0} [built] [707] multi main 40 bytes {0} [built]

ERROR in (webpack)-dev-server/client?http://localhost:3000 Module not found: Error: Can't resolve 'strip-ansi' in 'E:\study_work\angular2-seed-master\node_modules\webpack-dev-server\client' @ (webpack)-dev-server/client?http://localhost:3000 3:16-37 @ multi main

ERROR in (webpack)-dev-server/client/socket.js Module not found: Error: Can't resolve 'sockjs-client' in 'E:\study_work\angular2-seed-master\node_modules\webpack-dev-server\client' @ (webpack)-dev-server/client/socket.js 1:13-37 @ (webpack)-dev-server/client?http://localhost:3000 @ multi main webpack: bundle is now VALID.

How can I fix it?

blackcatIan commented 7 years ago

It's seems there is some problem with cnpm. I deleted node_modules,and try to use nrm My friend suggest me to use "nrm" instead of "cnpm".It just change the registry and use "npm" command as usual. I tried and it worked!