我使用npm和-g选项安装了express模块。该命令显示在bash浏览器中但在节点终端中显示此错误。
require.resolve('express')
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:339:15)
at Function.require.resolve (internal/module.js:23:19)
at repl:1:9
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:95:20)
at REPLServer.emit (events.js:182:7)
at REPLServer.Interface._onLine (readline.js:211:10)
我做错了什么? 我也安装了快速发电机,但仍然不会
我的.bashrc
文件包含以下条目:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
答案 0 :(得分:2)
在放置package.json
的目录中运行此命令npm install express --save