Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript npm安装成功后未定义手写笔_Javascript_Node.js_Stylus - Fatal编程技术网

Javascript npm安装成功后未定义手写笔

Javascript npm安装成功后未定义手写笔,javascript,node.js,stylus,Javascript,Node.js,Stylus,我试图跟随一个教程,学习一下node.js。不过,我一直在犯一个奇怪的错误。在npm安装触控笔后,我得到以下信息: npm http GET https://registry.npmjs.org/stylus npm http 304 https://registry.npmjs.org/stylus npm http GET https://registry.npmjs.org/mkdirp npm http GET https://registry.npmjs.org/ npm http G

我试图跟随一个教程,学习一下node.js。不过,我一直在犯一个奇怪的错误。在
npm安装触控笔后,我得到以下信息:

npm http GET https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/stylus
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/sax
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/sax
stylus@0.41.0 node_modules/stylus
├── debug@0.7.4
├── mkdirp@0.3.5
├── cssom@0.2.5
└── sax@0.5.5
没有错误,没有任何关于世界末日的警告,甚至没有任何红色文字。然后,当我尝试运行应用程序
node app.js
时,我得到
ReferenceError:stylus未定义在这一行上

app.use(stylus.middleware(
{
    src: __dirname + '/public'
    , compile: compile
}
))

npm安装
只需在磁盘上创建JS文件即可

您仍然需要调用
require()
来加载文件并创建局部变量:

var stylus = require('stylus');

嘎。我有var
stylue=require('stylus')
,但没有捕捉到它。问题解决了,谢谢!