首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启动服务器时找不到模块'express-stormpath‘

启动服务器时找不到模块'express-stormpath‘
EN

Stack Overflow用户
提问于 2016-07-02 05:26:12
回答 0查看 470关注 0票数 1

当我尝试运行node server.js (在没有超级用户或超级用户身份的普通终端中)时,我得到这个错误:

代码语言:javascript
复制
alphaunlimitedg@AUNs-PC:~/my-webapp$ node server.js
module.js:442
    throw err;
    ^

Error: Cannot find module 'express-stormpath'
    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> (/home/alphaunlimitedg/my-webapp/server.js:2:17)
    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)
alphaunlimitedg@AUNs-PC:~/my-webapp$

我已经使用以下命令在根用户、超级用户和普通用户中安装了express包:npm install express

它工作了,没有给出任何错误!但它仍然显示上面的错误。有什么办法可以解决这个问题吗?

PS:这是我遵循的过程,如下所示:

代码语言:javascript
复制
alphaunlimitedg@AUNs-PC:~$ npm install express
/home/alphaunlimitedg
└─┬ express@4.14.0 
  ├─┬ accepts@1.3.3 
  │ ├─┬ mime-types@2.1.11 
  │ │ └── mime-db@1.23.0 
  │ └── negotiator@0.6.1 
  ├── array-flatten@1.1.1 
  ├── content-disposition@0.5.1 
  ├── content-type@1.0.2 
  ├── cookie@0.3.1 
  ├── cookie-signature@1.0.6 
  ├─┬ debug@2.2.0 
  │ └── ms@0.7.1 
  ├── depd@1.1.0 
  ├── encodeurl@1.0.1 
  ├── escape-html@1.0.3 
  ├── etag@1.7.0 
  ├─┬ finalhandler@0.5.0 
  │ ├── statuses@1.3.0 
  │ └── unpipe@1.0.0 
  ├── fresh@0.3.0 
  ├── merge-descriptors@1.0.1 
  ├── methods@1.1.2 
  ├─┬ on-finished@2.3.0 
  │ └── ee-first@1.1.1 
  ├── parseurl@1.3.1 
  ├── path-to-regexp@0.1.7 
  ├─┬ proxy-addr@1.1.2 
  │ ├── forwarded@0.1.0 
  │ └── ipaddr.js@1.1.1 
  ├── qs@6.2.0 
  ├── range-parser@1.2.0 
  ├─┬ send@0.14.1 
  │ ├── destroy@1.0.4 
  │ ├─┬ http-errors@1.5.0 
  │ │ ├── inherits@2.0.1 
  │ │ └── setprototypeof@1.0.1 
  │ └── mime@1.3.4 
  ├── serve-static@1.11.1 
  ├─┬ type-is@1.6.13 
  │ └── media-typer@0.3.0 
  ├── utils-merge@1.0.0 
  └── vary@1.1.0 

npm WARN enoent ENOENT: no such file or directory, open '/home/alphaunlimitedg/package.json'
npm WARN alphaunlimitedg No description
npm WARN alphaunlimitedg No repository field.
npm WARN alphaunlimitedg No README data
npm WARN alphaunlimitedg No license field.
alphaunlimitedg@AUNs-PC:~$ express --help
The program 'express' is currently not installed. You can install it by typing:
sudo apt install node-express-generator
alphaunlimitedg@AUNs-PC:~$ sudo apt install node-express-generator
[sudo] password for alphaunlimitedg: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libjs-inherits libjs-jquery libjs-node-uuid
  libjs-underscore libssl-dev libssl-doc libuv1 libuv1-dev zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  node-accepts node-buffer-crc32 node-commander node-cookie
  node-cookie-signature node-crc node-debug node-depd node-escape-html
  node-etag node-express node-fresh node-media-typer node-merge-descriptors
  node-methods node-mime node-mime-types node-mkdirp node-negotiator
  node-on-finished node-parseurl node-path-to-regexp node-qs node-range-parser
  node-send node-serve-static node-type-is node-utils-merge
The following NEW packages will be installed:
  node-accepts node-buffer-crc32 node-commander node-cookie
  node-cookie-signature node-crc node-debug node-depd node-escape-html
  node-etag node-express node-express-generator node-fresh node-media-typer
  node-merge-descriptors node-methods node-mime node-mime-types node-mkdirp
  node-negotiator node-on-finished node-parseurl node-path-to-regexp node-qs
  node-range-parser node-send node-serve-static node-type-is node-utils-merge
0 upgraded, 29 newly installed, 0 to remove and 11 not upgraded.
Need to get 203 kB/227 kB of archives.
After this operation, 1999 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-negotiator all 0.4.8-1 [6980 B]
Get:2 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-mime-types all 2.0.2-2 [17,4 kB]
Get:3 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-accepts all 1.1.1-1 [5314 B]
Get:4 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-buffer-crc32 all 0.2.1-1 [4876 B]
Get:5 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-commander all 2.4.0-1 [13,2 kB]
Get:6 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-cookie all 0.1.2-2 [3692 B]
Get:7 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-cookie-signature all 1.0.3-1 [3320 B]
Get:8 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-crc all 3.0.0-3 [8378 B]
Get:9 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-debug all 2.1.0+dfsg-2 [12,3 kB]
Get:10 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-depd all 1.0.0-1 [9982 B]
Get:11 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-escape-html all 1.0.1-1 [3016 B]
Get:12 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-etag all 1.4.0-1 [4692 B]
Get:13 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-parseurl all 1.3.0-1 [4544 B]
Get:14 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-methods all 1.1.0-1 [3104 B]
Get:15 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-media-typer all 0.3.0-1 [5408 B]
Get:16 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-type-is all 1.5.2-1 [5502 B]
Get:17 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-fresh all 0.2.0-1 [3226 B]
Get:18 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-on-finished all 2.1.0-2 [5668 B]
Get:19 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-range-parser all 0.0.4+git7d1cd72a-1 [3286 B]
Get:20 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-send all 0.9.4-1 [10,8 kB]
Get:21 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-merge-descriptors all 0.0.2-1 [3226 B]
Get:22 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-path-to-regexp all 1.0.1-1 [6512 B]
Get:23 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-utils-merge all 1.0.0-1 [3362 B]
Get:24 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-serve-static all 1.6.4-2 [6160 B]
Get:25 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-express all 4.1.1~dfsg-1 [41,5 kB]
Get:26 http://nl.archive.ubuntu.com/ubuntu xenial/universe amd64 node-express-generator all 4.0.0-2 [7478 B]
Fetched 203 kB in 0s (558 kB/s)                  
Selecting previously unselected package node-negotiator.
(Reading database ... 215457 files and directories currently installed.)
Preparing to unpack .../node-negotiator_0.4.8-1_all.deb ...
Unpacking node-negotiator (0.4.8-1) ...
Selecting previously unselected package node-mime-types.
Preparing to unpack .../node-mime-types_2.0.2-2_all.deb ...
Unpacking node-mime-types (2.0.2-2) ...
Selecting previously unselected package node-accepts.
Preparing to unpack .../node-accepts_1.1.1-1_all.deb ...
Unpacking node-accepts (1.1.1-1) ...
Selecting previously unselected package node-buffer-crc32.
Preparing to unpack .../node-buffer-crc32_0.2.1-1_all.deb ...
Unpacking node-buffer-crc32 (0.2.1-1) ...
Selecting previously unselected package node-commander.
Preparing to unpack .../node-commander_2.4.0-1_all.deb ...
Unpacking node-commander (2.4.0-1) ...
Selecting previously unselected package node-cookie.
Preparing to unpack .../node-cookie_0.1.2-2_all.deb ...
Unpacking node-cookie (0.1.2-2) ...
Selecting previously unselected package node-cookie-signature.
Preparing to unpack .../node-cookie-signature_1.0.3-1_all.deb ...
Unpacking node-cookie-signature (1.0.3-1) ...
Selecting previously unselected package node-crc.
Preparing to unpack .../node-crc_3.0.0-3_all.deb ...
Unpacking node-crc (3.0.0-3) ...
Selecting previously unselected package node-debug.
Preparing to unpack .../node-debug_2.1.0+dfsg-2_all.deb ...
Unpacking node-debug (2.1.0+dfsg-2) ...
Selecting previously unselected package node-depd.
Preparing to unpack .../node-depd_1.0.0-1_all.deb ...
Unpacking node-depd (1.0.0-1) ...
Selecting previously unselected package node-escape-html.
Preparing to unpack .../node-escape-html_1.0.1-1_all.deb ...
Unpacking node-escape-html (1.0.1-1) ...
Selecting previously unselected package node-etag.
Preparing to unpack .../node-etag_1.4.0-1_all.deb ...
Unpacking node-etag (1.4.0-1) ...
Selecting previously unselected package node-parseurl.
Preparing to unpack .../node-parseurl_1.3.0-1_all.deb ...
Unpacking node-parseurl (1.3.0-1) ...
Selecting previously unselected package node-qs.
Preparing to unpack .../node-qs_2.2.4-1_all.deb ...
Unpacking node-qs (2.2.4-1) ...
Selecting previously unselected package node-methods.
Preparing to unpack .../node-methods_1.1.0-1_all.deb ...
Unpacking node-methods (1.1.0-1) ...
Selecting previously unselected package node-media-typer.
Preparing to unpack .../node-media-typer_0.3.0-1_all.deb ...
Unpacking node-media-typer (0.3.0-1) ...
Selecting previously unselected package node-type-is.
Preparing to unpack .../node-type-is_1.5.2-1_all.deb ...
Unpacking node-type-is (1.5.2-1) ...
Selecting previously unselected package node-fresh.
Preparing to unpack .../node-fresh_0.2.0-1_all.deb ...
Unpacking node-fresh (0.2.0-1) ...
Selecting previously unselected package node-mime.
Preparing to unpack .../node-mime_1.3.4-1_all.deb ...
Unpacking node-mime (1.3.4-1) ...
Selecting previously unselected package node-on-finished.
Preparing to unpack .../node-on-finished_2.1.0-2_all.deb ...
Unpacking node-on-finished (2.1.0-2) ...
Selecting previously unselected package node-range-parser.
Preparing to unpack .../node-range-parser_0.0.4+git7d1cd72a-1_all.deb ...
Unpacking node-range-parser (0.0.4+git7d1cd72a-1) ...
Selecting previously unselected package node-send.
Preparing to unpack .../node-send_0.9.4-1_all.deb ...
Unpacking node-send (0.9.4-1) ...
Selecting previously unselected package node-merge-descriptors.
Preparing to unpack .../node-merge-descriptors_0.0.2-1_all.deb ...
Unpacking node-merge-descriptors (0.0.2-1) ...
Selecting previously unselected package node-path-to-regexp.
Preparing to unpack .../node-path-to-regexp_1.0.1-1_all.deb ...
Unpacking node-path-to-regexp (1.0.1-1) ...
Selecting previously unselected package node-utils-merge.
Preparing to unpack .../node-utils-merge_1.0.0-1_all.deb ...
Unpacking node-utils-merge (1.0.0-1) ...
Selecting previously unselected package node-serve-static.
Preparing to unpack .../node-serve-static_1.6.4-2_all.deb ...
Unpacking node-serve-static (1.6.4-2) ...
Selecting previously unselected package node-express.
Preparing to unpack .../node-express_4.1.1~dfsg-1_all.deb ...
Unpacking node-express (4.1.1~dfsg-1) ...
Selecting previously unselected package node-mkdirp.
Preparing to unpack .../node-mkdirp_0.5.0-1_all.deb ...
Unpacking node-mkdirp (0.5.0-1) ...
Selecting previously unselected package node-express-generator.
Preparing to unpack .../node-express-generator_4.0.0-2_all.deb ...
Unpacking node-express-generator (4.0.0-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up node-negotiator (0.4.8-1) ...
Setting up node-mime-types (2.0.2-2) ...
Setting up node-accepts (1.1.1-1) ...
Setting up node-buffer-crc32 (0.2.1-1) ...
Setting up node-commander (2.4.0-1) ...
Setting up node-cookie (0.1.2-2) ...
Setting up node-cookie-signature (1.0.3-1) ...
Setting up node-crc (3.0.0-3) ...
Setting up node-debug (2.1.0+dfsg-2) ...
Setting up node-depd (1.0.0-1) ...
Setting up node-escape-html (1.0.1-1) ...
Setting up node-etag (1.4.0-1) ...
Setting up node-parseurl (1.3.0-1) ...
Setting up node-qs (2.2.4-1) ...
Setting up node-methods (1.1.0-1) ...
Setting up node-media-typer (0.3.0-1) ...
Setting up node-type-is (1.5.2-1) ...
Setting up node-fresh (0.2.0-1) ...
Setting up node-mime (1.3.4-1) ...
Setting up node-on-finished (2.1.0-2) ...
Setting up node-range-parser (0.0.4+git7d1cd72a-1) ...
Setting up node-send (0.9.4-1) ...
Setting up node-merge-descriptors (0.0.2-1) ...
Setting up node-path-to-regexp (1.0.1-1) ...
Setting up node-utils-merge (1.0.0-1) ...
Setting up node-serve-static (1.6.4-2) ...
Setting up node-express (4.1.1~dfsg-1) ...
Setting up node-mkdirp (0.5.0-1) ...
Setting up node-express-generator (4.0.0-2) ...
alphaunlimitedg@AUNs-PC:~$ cd my-webapp
alphaunlimitedg@AUNs-PC:~/my-webapp$ node server.js
module.js:442
    throw err;
    ^

Error: Cannot find module 'express-stormpath'
    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> (/home/alphaunlimitedg/my-webapp/server.js:2:17)
    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)
alphaunlimitedg@AUNs-PC:~/my-webapp$ sudo apt-get install node-express
Reading package lists... Done
Building dependency tree       
Reading state information... Done
node-express is already the newest version (4.1.1~dfsg-1).
node-express set to manually installed.
The following packages were automatically installed and are no longer required:
  gyp javascript-common libjs-inherits libjs-jquery libjs-node-uuid
  libjs-underscore libssl-dev libssl-doc libuv1 libuv1-dev zlib1g-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
alphaunlimitedg@AUNs-PC:~/my-webapp$ node server.js
module.js:442
    throw err;
    ^

Error: Cannot find module 'express-stormpath'
    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> (/home/alphaunlimitedg/my-webapp/server.js:2:17)
    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)
alphaunlimitedg@AUNs-PC:~/my-webapp$ 
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38154067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档