我正在尝试启动并运行现有的MEAN应用程序。但是,我完全没有在我的Mac上设置本地环境。
我没有创建这个网络应用程序,因此让事情变得更加混乱。
概要
我想要启动并运行现有的网络应用程序。我安装了node.js并确保MongoDB正在运行。我导航到我的应用程序的/ server目录并运行npm start
。然后,当我试图运行npm bugs <package-name>
时,我收到一个错误,指出包有问题。然后我运行了<package-name>
,它说npm start
不在npm注册表中。
详情
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@3.6.0
3 info using node@v5.7.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle groep4@0.0.1~prestart: groep4@0.0.1
6 silly lifecycle groep4@0.0.1~prestart: no script for restart, continuing
7 info lifecycle groep4@0.0.1~start: groep4@0.0.1
8 verbose lifecycle groep4@0.0.1~start: unsafe-perm in lifecycle true
9 verbose lifecycle groep4@0.0.1~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Sander/Documents/game-out/server/node_modules/.bin:/Users/Sander/.rvm/gems/ruby-1.9.3-p392/bin:/Users/Sander/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/Sander/.rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Sander/.rvm/bin
10 verbose lifecycle groep4@0.0.1~start: CWD: /Users/Sander/Documents/game-out/server
11 silly lifecycle groep4@0.0.1~start: Args: [ '-c', 'node bin/www.js' ]
12 silly lifecycle groep4@0.0.1~start: Returned: code: 1 signal: null
13 info lifecycle groep4@0.0.1~start: Failed to exec start script
14 verbose stack Error: groep4@0.0.1 start: `node bin/www.js`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid groep4@0.0.1
16 verbose cwd /Users/Sander/Documents/game-out/server
17 error Darwin 15.3.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v5.7.0
20 error npm v3.6.0
21 error code ELIFECYCLE
22 error groep4@0.0.1 start: `node bin/www.js`
22 error Exit status 1
23 error Failed at the groep4@0.0.1 start script 'node bin/www.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the groep4 package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node bin/www.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs groep4
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls groep4
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
给了我这个npm-debug.log:
npm bugs groep4
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'bugs', 'groep4' ]
2 info using npm@3.6.0
3 info using node@v5.7.0
4 silly fetchPackageMetaData groep4
5 silly fetchNamedPackageData groep4
6 silly mapToRegistry name groep4
7 silly mapToRegistry using default registry
8 silly mapToRegistry registry https://registry.npmjs.org/
9 silly mapToRegistry uri https://registry.npmjs.org/groep4
10 verbose request uri https://registry.npmjs.org/groep4
11 verbose request no auth needed
12 info attempt registry request try #1 at 10:01:10 PM
13 verbose request using bearer token for auth
14 verbose request id 4a6ce97af77a8f09
15 http request GET https://registry.npmjs.org/groep4
16 http 404 https://registry.npmjs.org/groep4
17 verbose headers { 'content-type': 'application/json',
17 verbose headers 'cache-control': 'max-age=0',
17 verbose headers 'content-length': '2',
17 verbose headers 'accept-ranges': 'bytes',
17 verbose headers date: 'Thu, 25 Feb 2016 21:01:11 GMT',
17 verbose headers via: '1.1 varnish',
17 verbose headers connection: 'keep-alive',
17 verbose headers 'x-served-by': 'cache-ams4146-AMS',
17 verbose headers 'x-cache': 'MISS',
17 verbose headers 'x-cache-hits': '0',
17 verbose headers 'x-timer': 'S1456434071.123107,VS0,VE697' }
18 silly get cb [ 404,
18 silly get { 'content-type': 'application/json',
18 silly get 'cache-control': 'max-age=0',
18 silly get 'content-length': '2',
18 silly get 'accept-ranges': 'bytes',
18 silly get date: 'Thu, 25 Feb 2016 21:01:11 GMT',
18 silly get via: '1.1 varnish',
18 silly get connection: 'keep-alive',
18 silly get 'x-served-by': 'cache-ams4146-AMS',
18 silly get 'x-cache': 'MISS',
18 silly get 'x-cache-hits': '0',
18 silly get 'x-timer': 'S1456434071.123107,VS0,VE697' } ]
19 silly fetchPackageMetaData Error: Registry returned 404 for GET on https://registry.npmjs.org/groep4
19 silly fetchPackageMetaData at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:264:12)
19 silly fetchPackageMetaData at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:242:14)
19 silly fetchPackageMetaData at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
19 silly fetchPackageMetaData at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:198:22)
19 silly fetchPackageMetaData at emitTwo (events.js:100:13)
19 silly fetchPackageMetaData at Request.emit (events.js:185:7)
19 silly fetchPackageMetaData at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1035:10)
19 silly fetchPackageMetaData at emitOne (events.js:95:20)
19 silly fetchPackageMetaData at Request.emit (events.js:182:7)
19 silly fetchPackageMetaData at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:962:12)
19 silly fetchPackageMetaData error for groep4 { [Error: Registry returned 404 for GET on https://registry.npmjs.org/groep4] pkgid: 'groep4', statusCode: 404, code: 'E404' }
20 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/groep4
20 verbose stack at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:264:12)
20 verbose stack at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:242:14)
20 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
20 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:198:22)
20 verbose stack at emitTwo (events.js:100:13)
20 verbose stack at Request.emit (events.js:185:7)
20 verbose stack at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1035:10)
20 verbose stack at emitOne (events.js:95:20)
20 verbose stack at Request.emit (events.js:182:7)
20 verbose stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:962:12)
21 verbose statusCode 404
22 verbose pkgid groep4
23 verbose cwd /Users/Sander/Documents/game-out/server
24 error Darwin 15.3.0
25 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "bugs" "groep4"
26 error node v5.7.0
27 error npm v3.6.0
28 error code E404
29 error 404 Registry returned 404 for GET on https://registry.npmjs.org/groep4
30 error 404
31 error 404 'groep4' is not in the npm registry.
32 error 404 You should bug the author to publish it (or use the name yourself!)
33 error 404 Note that you can also install from a
34 error 404 tarball, folder, http url, or git url.
35 verbose exit [ 1, true ]
给了我以下npm-debug.log:
npm start
因此我一直在阅读关于npm和包的大量内容。我尝试从包中创建一个tarball,json并安装它。但没有任何结果。运行sudo npm install -g mean-cli
时,我仍然遇到同样的错误。
我还与那位https://registry.npmjs.org/groep4从未存在的应用程序的用户进行了双重检查。所以问题不仅仅是注册表被清空,这是我最初的想法。
我设法使用mean init yourNewApp
和char *a="gizzzzz";
char *b="figantic";
void swap(char **ptr1,char **ptr2){
char temp = **ptr1;
**ptr1 = **ptr2;
**ptr2 = temp;
}
启动并运行新的MEAN堆栈应用程序。然后我按照屏幕上的说明设置了所有内容。它工作正常。所以我假设问题不在于node.js或MongoDB。
我做了整个事情available via GitHub,也许这会给出一些背景。
我提供了我能想到的每一个细节,但请不要犹豫,要求任何你需要的东西。
答案 0 :(得分:0)
经过大量的故障排除后,我找到了答案。我将在此发布以供将来参考。
该错误有点误导,因为该包与任何事情无关。问题实际上是配置文件。第一步是正确设置。
此外,服务器应以node server.js
而不是npm start
启动。
为我修好了。我现在已经在我的本地环境中运行了应用程序。