Picture of Nicola Willis
Node error when installing framework through tool
by Nicola Willis - Thursday, 28 February 2019, 10:56 AM
 

Morning all,

I'm trying to install the authoring tool and I keep running into a node error when the tool's install script attempts to install the node modules in the framework. 

I have 0.6.5 of the authoring tool and I am attempting to install with 4.0.1 of the framework.

The install script gets to the part where it must install the master tenant. It appears to be successfully cloning the framework and falling over when installing it's dependencies. I've included the output of the install script and the output of the debug log below.

I am currently using node 8.12.0 and npm 6.4.1.

I have tried this with node 10.15.1 and got the same output, I have tried `npm cache clean --force` but it doesn't seem to have any effect. 

This is on an internally accessible server that uses apache to proxy adapt.

I think that this might be a node issue rather than an adapt issue, I wondered if anyone else had come across something like this before?

Thanks for any help
Nicola


Install script:

```

Now configuring the master tenant.

> Set a unique name for your tenant (master)
> Set the display name for your tenant (Master)

Tenant 'master' already exists. It must be deleted for install to continue.
> Continue? (Y/n) (Y)

Cloned https://github.com/adaptlearning/adapt_framework.git successfully.
/temp/5c77b3adc66a6d752153d03d/adapt_framework switched to revision tags/v4.0.1
error: [28 Feb 2019 10:11:10 +00:00] Error downloading the framework npm ERR! Unexpected token in JSON at position 2078 while parsing near '...on":"0.2.3","depende...'

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-02-28T10_11_10_829Z-debug.log

ERROR: npm ERR! Unexpected token in JSON at position 2078 while parsing near '...on":"0.2.3","depende...'


```

Debug log:

```

961 http fetch GET 200 https://registry.npmjs.org/time-grunt 9ms (from cache)
962 silly fetchPackageMetaData error for time-grunt@^2.0.0 Unexpected token ^@ in JSON at position 2078 while parsing near '...on":"0.2.3","depende^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@...'
963 timing stage:rollbackFailedOptional Completed in 0ms
964 timing stage:runTopLevelLifecycles Completed in 2142ms
965 silly saveTree adapt_framework@4.0.1
965 silly saveTree ~T~\~T~@~T~@ async@2.6.2
965 silly saveTree ~T~\~T~@~T~@ chalk@2.4.2
965 silly saveTree ~T~\~T~@~T~@ columnify@1.5.4
965 silly saveTree ~T~\~T~@~T~@ csv@5.1.1
965 silly saveTree ~T~\~T~@~T~@ grunt-concurrent@2.3.1
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-clean@2.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-connect@2.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-copy@1.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-jshint@2.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-uglify@4.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-contrib-watch@1.1.0
965 silly saveTree ~T~\~T~@~T~@ grunt-file-order@1.0.0
965 silly saveTree ~T~\~T~@~T~@ grunt-jscs@3.0.1
965 silly saveTree ~T~\~T~@~T~@ grunt-json-minify@1.1.0
965 silly saveTree ~T~\~T~@~T~@ grunt-jsonlint@1.1.0
965 silly saveTree ~T~\~T~@~T~@ grunt-newer@1.3.0
965 silly saveTree ~T~\~T~@~T~@ grunt-replace@1.0.1
965 silly saveTree ~T~\~T~@~T� grunt@1.0.3
965 silly saveTree ~T~B ~T~T~T~@~T~@ iconv-lite@0.4.24
965 silly saveTree ~T~\~T~@~T~@ handlebars@4.1.0
965 silly saveTree ~T~\~T~@~T~@ iconv-lite@0.4.24
965 silly saveTree ~T~\~T~@~T~@ jit-grunt@0.10.0
965 silly saveTree ~T~\~T~@~T~@ jschardet@1.6.0
965 silly saveTree ~T~\~T~@~T~@ jshint-stylish@2.2.1
965 silly saveTree ~T~\~T~@~T~@ less@3.9.0
965 silly saveTree ~T~\~T~@~T~@ load-grunt-config@1.0.1
965 silly saveTree ~T~\~T~@~T~@ nsdeclare@0.1.0
965 silly saveTree ~T~\~T~@~T~@ requirejs@2.3.6
965 silly saveTree ~T~\~T~@~T~@ underscore-deep-extend@1.1.5
965 silly saveTree ~T~T~T~@~T~@ underscore@1.9.1
966 verbose stack SyntaxError: Unexpected token ^@ in JSON at position 2078 while parsing near '...on":"0.2.3","depende^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@...'
966 verbose stack at JSON.parse (<anonymous>)
966 verbose stack at parseJson (/home/ubuntu/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
966 verbose stack at consumeBody.call.then.buffer (/home/ubuntu/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
966 verbose stack at <anonymous>
966 verbose stack at process._tickCallback (internal/process/next_tick.js:189:7)


```

Picture of Matt Leathes
Re: Node error when installing framework through tool
by Matt Leathes - Thursday, 28 February 2019, 12:03 PM
 
I think that this might be a node issue rather than an adapt issue,

I agree. Also, if you look up that error on npmjs it suggest that it 'can be caused by corporate proxies that give HTML responses to package.json requests'.

I just tried installing the framework using the adapt-cli and note that I got a warning about time-grunt - which I think is where it's falling over for you.

I wonder if it's something about that 'deprecated' message that's causing a problem?

Picture of Nicola Willis
Re: Node error when installing framework through tool
by Nicola Willis - Thursday, 28 February 2019, 3:33 PM
 

Hi Matt, 

Thank you so much for your response.

Well, I can say it's fixed although I can't say I'm 100% certain as to why. After struggling with this for days I updated pm2 from 3.2.2 to 3.2.9, this caused some problems so I reverted it back to 3.2.2 and then noticed this was working.

I have since re-upgraded pm2 to 3.2.9 with no issue. 

Posting this in case anybody else gets stuck on this in future. 
Thanks