首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误本地Npm模块"jshint-stylish“在本地存在时找不到(通过symlink)

错误本地Npm模块"jshint-stylish“在本地存在时找不到(通过symlink)
EN

Stack Overflow用户
提问于 2014-06-10 22:07:52
回答 3查看 6.8K关注 0票数 2

我有一个linux符号链接,指向grunt文件所在文件夹中的node_modules文件夹,但当我运行grunt时,我得到的结果是:

找不到本地Npm模块"jshint-stylish“。安装好了吗?

我的所有其他npm模块都工作得很好,有什么想法吗?

我的grunt文件:

代码语言:javascript
复制
module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-open');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-closure-compiler');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('jshint-stylish');

权限:

代码语言:javascript
复制
me@pc:~/dev/root/node_modules$ ls -l
total 96

..
drwxr-xr-x 3 me me 4096 Jun 10 14:57 grunt-shell
drwxr-xr-x 3 me me 4096 Jun 10 15:00 jshint-stylish

..

EDIT_____________________我以记者的身份使用它:

代码语言:javascript
复制
  jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
EN

回答 3

Stack Overflow用户

发布于 2015-12-11 05:04:03

尝试手动安装模块。

代码语言:javascript
复制
npm install jshint-stylish

对我很管用。

票数 4
EN

Stack Overflow用户

发布于 2016-11-08 02:44:00

load-grunt configs owner creynders提示here该错误

“找不到本地Npm模块'jshint-stylish‘。是否已安装?”

显然是由于在jshint.js配置文件中需要使用jshint-stylish。

它找不到jshint-stylish模块,因为它位于项目外部的目录中。

然而,我无法让他的建议对我起作用,但我找到了自己的方法:

代码语言:javascript
复制
// gruntfile.js
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    config: grunt.file.readJSON('grunt-config.json'),
    jshint_reporter: require('jshint-stylish')
});

// grunt-config.json
{
    "jsHintFiles" : [
        "**/modules/*.js"
    ]
}

// jshint.js
module.exports = function(grunt) {
    "use strict";

    grunt.config.merge({"jshint": {
        "default": {
            options: {
                reporter: "<%= jshint_reporter %>"
            },
            src: ["<%= config.jsHintFiles %>"]
        }
    }});
};
票数 0
EN

Stack Overflow用户

发布于 2019-07-17 00:29:12

检查您的NODE_PATH环境变量是否引用了您的node_modules目录。

在本地它将是:

导出节点路径=./节点模块

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

https://stackoverflow.com/questions/24143154

复制
相关文章

相似问题

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